diff --git a/download_links.json b/download_links.json
new file mode 100644
index 00000000..1369269b
--- /dev/null
+++ b/download_links.json
@@ -0,0 +1,5 @@
+{
+ "windows": "https://gitee.com/zhoubochina/MooTool/attach_files/944394/download/MooTool-1.4.1-windows.exe",
+ "mac": "https://gitee.com/zhoubochina/MooTool/attach_files/944348/download/MooTool_1.4.1.dmg",
+ "linux": "https://gitee.com/zhoubochina/MooTool/attach_files/944310/download/MooTool_1.4.1.deb"
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 80c7dc7c..57f99b3a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.luoboduner.moo.tool
MooTool
- 1.4.1
+ 1.4.2
jar
MooTool
@@ -165,6 +165,12 @@
+
+ com.jayway.jsonpath
+ json-path
+ 2.6.0
+
+
@@ -187,38 +193,38 @@
true
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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ bundling-for-windows
+ package
+
+ package
+
+
+ windows
+ true
+ true
+
+
+
+ true
+ true
+ true
+
+
+ installForAllUsers
+ true
+ false
+ false
+
+ compiler:Default.isl
+
+
+
+
+
@@ -230,18 +236,18 @@
-
- bundling-for-mac
- package
-
- package
-
-
- mac
- true
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/screen_shoot/quick_note_mac.png b/screen_shoot/quick_note_mac.png
index 57ac34c7..ec7f7b27 100644
Binary files a/screen_shoot/quick_note_mac.png and b/screen_shoot/quick_note_mac.png differ
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 a0cf27e5..dd7f6609 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/UiConsts.java
+++ b/src/main/java/com/luoboduner/moo/tool/ui/UiConsts.java
@@ -16,7 +16,7 @@ public class UiConsts {
* 软件名称,版本
*/
public static final String APP_NAME = "MooTool";
- public static final String APP_VERSION = "v1.4.1";
+ public static final String APP_VERSION = "v1.4.2";
public static final int TABLE_ROW_HEIGHT = 36;
@@ -91,6 +91,11 @@ public class UiConsts {
*/
public static final String CHECK_VERSION_URL = "https://gitee.com/zhoubochina/MooTool/raw/master/src/main/resources/version_summary.json";
+ /**
+ * 软件下载链接信息url
+ */
+ public static final String DOWNLOAD_LINK_INFO_URL = "https://gitee.com/zhoubochina/MooTool/raw/develop/download_links.json";
+
/**
* 二维码url
*/
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/component/TopMenuBar.java b/src/main/java/com/luoboduner/moo/tool/ui/component/TopMenuBar.java
index 0d31affe..100f1f26 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/component/TopMenuBar.java
+++ b/src/main/java/com/luoboduner/moo/tool/ui/component/TopMenuBar.java
@@ -48,7 +48,7 @@ public class TopMenuBar extends JMenuBar {
"IntelliJ Cyan",
"IntelliJ Light"};
- private static String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
+ public static String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
private static String[] fontSizes = {
"5",
@@ -188,6 +188,29 @@ public void init() {
aboutMenu.add(aboutMenuItem);
topMenuBar.add(aboutMenu);
+
+ // ---------鼓励和支持
+ JMenu supportMeMenu = new JMenu();
+ supportMeMenu.setText("鼓励和支持");
+
+ // 鼓励和支持
+ JMenuItem supportMeMenuItem = new JMenuItem();
+ supportMeMenuItem.setText("鼓励和支持");
+ supportMeMenuItem.addActionListener(e -> supportMeActionPerformed());
+ supportMeMenu.add(supportMeMenuItem);
+
+ topMenuBar.add(supportMeMenu);
+ }
+
+ private void supportMeActionPerformed() {
+ try {
+ SupportMeDialog dialog = new SupportMeDialog();
+
+ dialog.pack();
+ dialog.setVisible(true);
+ } catch (Exception e2) {
+ logger.error(e2);
+ }
}
private void syncAndBackupActionPerformed() {
@@ -286,7 +309,7 @@ private void fontSizeChanged(ActionEvent actionEvent) {
}
- private void fontFamilyChanged(ActionEvent actionEvent) {
+ public void fontFamilyChanged(ActionEvent actionEvent) {
try {
String selectedFamily = actionEvent.getActionCommand();
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/CurrentHostDialog.form b/src/main/java/com/luoboduner/moo/tool/ui/dialog/CurrentHostDialog.form
index 8707d2db..47345374 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/dialog/CurrentHostDialog.form
+++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/CurrentHostDialog.form
@@ -21,7 +21,7 @@
-
+
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/CurrentHostDialog.java b/src/main/java/com/luoboduner/moo/tool/ui/dialog/CurrentHostDialog.java
index 80250640..7523bb06 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/dialog/CurrentHostDialog.java
+++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/CurrentHostDialog.java
@@ -8,6 +8,7 @@
import lombok.Getter;
import javax.swing.*;
+import javax.swing.border.TitledBorder;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
@@ -83,6 +84,7 @@ public void setPlaneText(String planeText) {
contentPane.add(panel1, 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 JScrollPane scrollPane1 = new JScrollPane();
panel1.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));
+ scrollPane1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
textArea = new JTextArea();
textArea.setEditable(false);
scrollPane1.setViewportView(textArea);
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/SettingDialog.form b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SettingDialog.form
index 17a3126e..6fc4bf39 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/dialog/SettingDialog.form
+++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SettingDialog.form
@@ -26,7 +26,7 @@
-
+
@@ -36,7 +36,7 @@
-
+
@@ -62,6 +62,14 @@
+
+
+
+
+
+
+
+
@@ -74,6 +82,15 @@
+
+
+
+
+
+
+
+
+
@@ -81,10 +98,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -120,7 +182,7 @@
-
+
@@ -180,7 +242,7 @@
-
+
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 cfd69444..f9925727 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
@@ -8,7 +8,9 @@
import com.intellij.uiDesigner.core.Spacer;
import com.luoboduner.moo.tool.App;
import com.luoboduner.moo.tool.service.HttpMsgSender;
+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;
@@ -21,10 +23,7 @@
import javax.swing.plaf.FontUIResource;
import javax.swing.text.StyleContext;
import java.awt.*;
-import java.awt.event.ItemEvent;
-import java.awt.event.KeyEvent;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
+import java.awt.event.*;
import java.io.File;
import java.util.Locale;
@@ -47,11 +46,13 @@ public class SettingDialog extends JDialog {
private JTextField httpProxyPortTextField;
private JTextField httpProxyUserTextField;
private JTextField httpProxyPasswordTextField;
+ private JComboBox sqlDialectComboBox;
+ private JComboBox fontFamilyComboBox;
public SettingDialog() {
super(App.mainFrame, "设置");
- ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.5, 0.6);
+ ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.5, 0.68);
setContentPane(contentPane);
setModal(true);
@@ -84,6 +85,13 @@ public void windowClosing(WindowEvent e) {
// 使用习惯
menuBarPositionComboBox.setSelectedItem(App.config.getMenuBarPosition());
+ // sql dialect
+ sqlDialectComboBox.setSelectedItem(App.config.getSqlDialect());
+
+ // 字体
+ initFontFamilyMenu();
+ fontFamilyComboBox.setSelectedItem(App.config.getFont());
+
// 高级
dbFilePathTextField.setText(App.config.getDbFilePath());
@@ -130,6 +138,21 @@ public void windowClosing(WindowEvent e) {
}
});
+ sqlDialectComboBox.addItemListener(e -> {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ App.config.setSqlDialect(e.getItem().toString());
+ App.config.save();
+ }
+ });
+
+ fontFamilyComboBox.addItemListener(e -> {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ App.config.setFont(e.getItem().toString());
+ App.config.save();
+ MainFrame.topMenuBar.fontFamilyChanged(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, e.getItem().toString()));
+ }
+ });
+
// 高级 数据文件路径设置
dbFilePathSaveButton.addActionListener(e -> {
try {
@@ -183,7 +206,7 @@ private void onOK() {
/**
* 切换HTTP代理设置面板显示/隐藏
*/
- public void toggleHttpProxyPanel() {
+ private void toggleHttpProxyPanel() {
boolean httpUseProxy = httpUseProxyCheckBox.isSelected();
if (httpUseProxy) {
@@ -193,6 +216,14 @@ public void toggleHttpProxyPanel() {
}
}
+ private void initFontFamilyMenu() {
+
+ fontFamilyComboBox.removeAllItems();
+ for (String font : TopMenuBar.fontNames) {
+ fontFamilyComboBox.addItem(font);
+ }
+ }
+
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
@@ -219,10 +250,10 @@ public void toggleHttpProxyPanel() {
final Spacer spacer1 = new Spacer();
panel1.add(spacer1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
final JPanel panel2 = new JPanel();
- panel2.setLayout(new GridLayoutManager(4, 1, new Insets(0, 0, 0, 0), -1, -1));
+ panel2.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));
panel1.add(panel2, 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, new Dimension(600, -1), null, 0, false));
final JPanel panel3 = new JPanel();
- panel3.setLayout(new GridLayoutManager(2, 3, new Insets(15, 15, 25, 0), -1, -1));
+ panel3.setLayout(new GridLayoutManager(3, 3, new Insets(15, 15, 25, 0), -1, -1));
panel2.add(panel3, 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));
panel3.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "常规", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel3.getFont()), null));
autoCheckUpdateCheckBox = new JCheckBox();
@@ -231,6 +262,9 @@ public void toggleHttpProxyPanel() {
final JLabel label1 = new JLabel();
label1.setText("语言");
panel3.add(label1, 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 label2 = new JLabel();
+ label2.setText("字体");
+ panel3.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));
comboBox1 = new JComboBox();
comboBox1.setEnabled(false);
final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
@@ -238,87 +272,116 @@ public void toggleHttpProxyPanel() {
defaultComboBoxModel1.addElement("English");
comboBox1.setModel(defaultComboBoxModel1);
panel3.add(comboBox1, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ fontFamilyComboBox = new JComboBox();
+ fontFamilyComboBox.setEnabled(true);
+ final DefaultComboBoxModel defaultComboBoxModel2 = new DefaultComboBoxModel();
+ fontFamilyComboBox.setModel(defaultComboBoxModel2);
+ panel3.add(fontFamilyComboBox, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer2 = new Spacer();
panel3.add(spacer2, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JPanel panel4 = new JPanel();
panel4.setLayout(new GridLayoutManager(1, 3, new Insets(15, 15, 25, 0), -1, -1));
- panel2.add(panel4, 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));
- panel4.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "使用习惯", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel4.getFont()), null));
- final JLabel label2 = new JLabel();
- label2.setText("菜单栏(按钮操作区)位置");
- panel4.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));
+ panel2.add(panel4, 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));
+ panel4.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), " 随手记", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel4.getFont()), null));
+ final JLabel label3 = new JLabel();
+ label3.setText("SQL\"方言\"(dialect)");
+ panel4.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));
+ sqlDialectComboBox = new JComboBox();
+ sqlDialectComboBox.setEnabled(true);
+ final DefaultComboBoxModel defaultComboBoxModel3 = new DefaultComboBoxModel();
+ defaultComboBoxModel3.addElement("Standard SQL");
+ defaultComboBoxModel3.addElement("MariaDB");
+ defaultComboBoxModel3.addElement("MySQL");
+ defaultComboBoxModel3.addElement("PostgreSQL");
+ defaultComboBoxModel3.addElement("IBM DB2");
+ defaultComboBoxModel3.addElement("Oracle PL/SQL");
+ defaultComboBoxModel3.addElement("Couchbase N1QL");
+ defaultComboBoxModel3.addElement("Amazon Redshift");
+ defaultComboBoxModel3.addElement("Spark");
+ defaultComboBoxModel3.addElement("SQL Server Transact-SQL");
+ sqlDialectComboBox.setModel(defaultComboBoxModel3);
+ panel4.add(sqlDialectComboBox, 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 Spacer spacer3 = new Spacer();
panel4.add(spacer3, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
- menuBarPositionComboBox = new JComboBox();
- final DefaultComboBoxModel defaultComboBoxModel2 = new DefaultComboBoxModel();
- defaultComboBoxModel2.addElement("上方");
- defaultComboBoxModel2.addElement("下方");
- menuBarPositionComboBox.setModel(defaultComboBoxModel2);
- panel4.add(menuBarPositionComboBox, 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 panel5 = new JPanel();
- panel5.setLayout(new GridLayoutManager(2, 3, new Insets(15, 15, 25, 0), -1, -1));
+ panel5.setLayout(new GridLayoutManager(1, 3, new Insets(15, 15, 25, 0), -1, -1));
panel2.add(panel5, 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_CAN_GROW, null, null, null, 0, false));
- panel5.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "高级", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel5.getFont()), null));
- final JLabel label3 = new JLabel();
- label3.setText("数据存储位置");
- panel5.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));
+ panel5.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "使用习惯", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel5.getFont()), null));
+ final JLabel label4 = new JLabel();
+ label4.setText("菜单栏(按钮操作区)位置");
+ panel5.add(label4, 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 spacer4 = new Spacer();
+ panel5.add(spacer4, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+ menuBarPositionComboBox = new JComboBox();
+ final DefaultComboBoxModel defaultComboBoxModel4 = new DefaultComboBoxModel();
+ defaultComboBoxModel4.addElement("上方");
+ defaultComboBoxModel4.addElement("下方");
+ menuBarPositionComboBox.setModel(defaultComboBoxModel4);
+ panel5.add(menuBarPositionComboBox, 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 panel6 = new JPanel();
+ panel6.setLayout(new GridLayoutManager(2, 3, new Insets(15, 15, 25, 0), -1, -1));
+ panel2.add(panel6, new GridConstraints(4, 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));
+ panel6.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "高级", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel6.getFont()), null));
+ final JLabel label5 = new JLabel();
+ label5.setText("数据存储位置");
+ panel6.add(label5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
dbFilePathTextField = new JTextField();
- panel5.add(dbFilePathTextField, 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));
+ panel6.add(dbFilePathTextField, 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));
dbFilePathExploreButton = new JButton();
dbFilePathExploreButton.setText("…");
- panel5.add(dbFilePathExploreButton, 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 panel6 = new JPanel();
- panel6.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
- panel5.add(panel6, new GridConstraints(1, 0, 1, 3, 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));
+ panel6.add(dbFilePathExploreButton, 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 panel7 = new JPanel();
+ panel7.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
+ panel6.add(panel7, new GridConstraints(1, 0, 1, 3, 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));
dbFilePathSaveButton = new JButton();
dbFilePathSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
dbFilePathSaveButton.setText("保存");
- panel6.add(dbFilePathSaveButton, new GridConstraints(0, 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));
- final Spacer spacer4 = new Spacer();
- panel6.add(spacer4, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
- final JPanel panel7 = new JPanel();
- panel7.setLayout(new GridLayoutManager(3, 1, new Insets(15, 15, 25, 0), -1, -1));
- Font panel7Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel7.getFont());
- if (panel7Font != null) panel7.setFont(panel7Font);
- panel2.add(panel7, 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));
- panel7.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "HTTP请求", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel7.getFont()), null));
+ panel7.add(dbFilePathSaveButton, new GridConstraints(0, 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));
+ final Spacer spacer5 = new Spacer();
+ panel7.add(spacer5, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JPanel panel8 = new JPanel();
- panel8.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
- panel7.add(panel8, 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));
+ panel8.setLayout(new GridLayoutManager(3, 1, new Insets(15, 15, 25, 0), -1, -1));
+ Font panel8Font = this.$$$getFont$$$("Microsoft YaHei UI", -1, -1, panel8.getFont());
+ if (panel8Font != null) panel8.setFont(panel8Font);
+ panel2.add(panel8, 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));
+ panel8.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), "HTTP请求", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, this.$$$getFont$$$(null, Font.BOLD, -1, panel8.getFont()), null));
+ final JPanel panel9 = new JPanel();
+ panel9.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
+ panel8.add(panel9, 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));
httpSaveButton = new JButton();
httpSaveButton.setIcon(new ImageIcon(getClass().getResource("/icon/menu-saveall_dark.png")));
httpSaveButton.setText("保存");
- panel8.add(httpSaveButton, new GridConstraints(0, 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));
- final Spacer spacer5 = new Spacer();
- panel8.add(spacer5, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+ panel9.add(httpSaveButton, new GridConstraints(0, 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));
+ final Spacer spacer6 = new Spacer();
+ panel9.add(spacer6, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
httpUseProxyCheckBox = new JCheckBox();
httpUseProxyCheckBox.setText("使用HTTP代理");
- panel7.add(httpUseProxyCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ panel8.add(httpUseProxyCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
httpProxyPanel = new JPanel();
httpProxyPanel.setLayout(new GridLayoutManager(4, 2, new Insets(0, 26, 0, 0), -1, -1));
- panel7.add(httpProxyPanel, 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 label4 = new JLabel();
- label4.setText("Host");
- httpProxyPanel.add(label4, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ panel8.add(httpProxyPanel, 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 label6 = new JLabel();
+ label6.setText("Host");
+ httpProxyPanel.add(label6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
httpProxyHostTextField = new JTextField();
httpProxyPanel.add(httpProxyHostTextField, 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));
- final JLabel label5 = new JLabel();
- label5.setText("端口");
- httpProxyPanel.add(label5, 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 label6 = new JLabel();
- label6.setText("用户名");
- httpProxyPanel.add(label6, 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 label7 = new JLabel();
- label7.setText("密码");
- httpProxyPanel.add(label7, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ label7.setText("端口");
+ httpProxyPanel.add(label7, 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 label8 = new JLabel();
+ label8.setText("用户名");
+ httpProxyPanel.add(label8, 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 label9 = new JLabel();
+ label9.setText("密码");
+ httpProxyPanel.add(label9, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
httpProxyPortTextField = new JTextField();
httpProxyPanel.add(httpProxyPortTextField, 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));
httpProxyUserTextField = new JTextField();
httpProxyPanel.add(httpProxyUserTextField, 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));
httpProxyPasswordTextField = new JTextField();
httpProxyPanel.add(httpProxyPasswordTextField, 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));
- final Spacer spacer6 = new Spacer();
- panel1.add(spacer6, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+ final Spacer spacer7 = new Spacer();
+ panel1.add(spacer7, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
}
/**
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/SupportMeDialog.form b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SupportMeDialog.form
new file mode 100644
index 00000000..11385c76
--- /dev/null
+++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SupportMeDialog.form
@@ -0,0 +1,110 @@
+
+
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/SupportMeDialog.java b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SupportMeDialog.java
new file mode 100644
index 00000000..d6ce0dc5
--- /dev/null
+++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SupportMeDialog.java
@@ -0,0 +1,125 @@
+package com.luoboduner.moo.tool.ui.dialog;
+
+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 javax.swing.*;
+import javax.swing.border.TitledBorder;
+import java.awt.*;
+import java.awt.event.*;
+import java.util.Objects;
+
+/**
+ * 鼓励和支持
+ */
+public class SupportMeDialog extends JDialog {
+ private JPanel contentPane;
+ private JButton buttonOK;
+ private JLabel zanLabel;
+
+ public SupportMeDialog() {
+ super(App.mainFrame, "鼓励和支持");
+ ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.4, 0.6);
+ setContentPane(contentPane);
+ setModal(true);
+ getRootPane().setDefaultButton(buttonOK);
+
+ zanLabel.setIcon(new ImageIcon(Objects.requireNonNull(getClass().getResource("/icon/wx-zanshang.jpg"))));
+
+ buttonOK.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ onOK();
+ }
+ });
+
+ // 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(2, 1, new Insets(40, 20, 20, 20), -1, -1));
+ final JPanel panel1 = new JPanel();
+ panel1.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
+ contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false));
+ final Spacer spacer1 = new Spacer();
+ panel1.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 JPanel panel2 = new JPanel();
+ panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
+ panel1.add(panel2, new GridConstraints(0, 1, 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));
+ buttonOK = new JButton();
+ buttonOK.setText("OK");
+ panel2.add(buttonOK, new GridConstraints(0, 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));
+ final Spacer spacer2 = new Spacer();
+ panel1.add(spacer2, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+ final JScrollPane scrollPane1 = new JScrollPane();
+ contentPane.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));
+ scrollPane1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
+ final JPanel panel3 = new JPanel();
+ panel3.setLayout(new GridLayoutManager(4, 3, new Insets(0, 0, 0, 0), -1, -1));
+ scrollPane1.setViewportView(panel3);
+ final JLabel label1 = new JLabel();
+ label1.setText("如果MooTool项目对您有所帮助");
+ panel3.add(label1, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ final JLabel label2 = new JLabel();
+ label2.setText("欢迎对我每天下班和周末时光的努力进行支持");
+ panel3.add(label2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ final JLabel label3 = new JLabel();
+ label3.setText("您的赞赏将会给我带来更多动力");
+ panel3.add(label3, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ final Spacer spacer3 = new Spacer();
+ panel3.add(spacer3, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+ final Spacer spacer4 = new Spacer();
+ panel3.add(spacer4, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
+ zanLabel = new JLabel();
+ zanLabel.setText("");
+ panel3.add(zanLabel, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ }
+
+ /**
+ * @noinspection ALL
+ */
+ public JComponent $$$getRootComponent$$$() {
+ return contentPane;
+ }
+
+}
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/SyncAndBackupDialog.form b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SyncAndBackupDialog.form
index 5a866518..7100c77c 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/dialog/SyncAndBackupDialog.form
+++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SyncAndBackupDialog.form
@@ -3,7 +3,7 @@
-
+
@@ -30,7 +30,7 @@
-
+
@@ -111,7 +111,7 @@
-
+
@@ -119,96 +119,121 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/SyncAndBackupDialog.java b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SyncAndBackupDialog.java
index 02874245..b50cf08d 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/dialog/SyncAndBackupDialog.java
+++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/SyncAndBackupDialog.java
@@ -5,6 +5,7 @@
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import com.luoboduner.moo.tool.App;
+import com.luoboduner.moo.tool.ui.listener.func.ImageListener;
import com.luoboduner.moo.tool.util.ComponentUtil;
import com.luoboduner.moo.tool.util.SystemUtil;
import lombok.extern.slf4j.Slf4j;
@@ -12,9 +13,12 @@
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.io.File;
+import java.util.Locale;
/**
* 同步和备份
@@ -34,6 +38,8 @@ public class SyncAndBackupDialog extends JDialog {
private JCheckBox autoSyncCheckBox;
private JTextField localConfigTextField;
private JButton exportConfigButton;
+ private JButton openImageDirButton;
+ private JTextField imagePathTextField;
public SyncAndBackupDialog() {
super(App.mainFrame, "同步和备份");
@@ -47,6 +53,8 @@ public SyncAndBackupDialog() {
String localConfigPath = SystemUtil.CONFIG_HOME + File.separator + "config" + File.separator + "config.setting";
localConfigTextField.setText(localConfigPath);
+ imagePathTextField.setText(ImageListener.IMAGE_PATH_PRE_FIX);
+
// call onCancel() when cross is clicked
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
@@ -109,6 +117,15 @@ public void windowClosing(WindowEvent e) {
log.error(ExceptionUtils.getStackTrace(e2));
}
});
+
+ openImageDirButton.addActionListener(e -> {
+ try {
+ Desktop desktop = Desktop.getDesktop();
+ desktop.open(new File(ImageListener.IMAGE_PATH_PRE_FIX));
+ } catch (Exception e2) {
+ log.error(ExceptionUtils.getStackTrace(e2));
+ }
+ });
}
private void onOK() {
@@ -148,7 +165,7 @@ private void onCancel() {
panel1.add(panel2, 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));
panel2.setBorder(BorderFactory.createTitledBorder(null, "同步", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
final JPanel panel3 = new JPanel();
- panel3.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1));
+ panel3.setLayout(new GridLayoutManager(2, 2, new Insets(10, 0, 0, 0), -1, -1));
panel2.add(panel3, 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 label1 = new JLabel();
label1.setText("用于同步MooTool数据的Git仓库地址:");
@@ -179,39 +196,72 @@ private void onCancel() {
autoSyncCheckBox.setText("自动同步");
panel4.add(autoSyncCheckBox, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JPanel panel5 = new JPanel();
- panel5.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1));
+ panel5.setLayout(new GridLayoutManager(3, 1, new Insets(10, 10, 10, 10), -1, -1));
panel1.add(panel5, 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));
panel5.setBorder(BorderFactory.createTitledBorder(null, "备份", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
final JPanel panel6 = new JPanel();
- panel6.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
+ panel6.setLayout(new GridLayoutManager(2, 2, new Insets(10, 0, 0, 0), -1, -1));
panel5.add(panel6, 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 JPanel panel7 = new JPanel();
- panel7.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1));
- panel6.add(panel7, 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("本地数据路径:");
- panel7.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));
+ panel6.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));
localDataPathTextField = new JTextField();
localDataPathTextField.setEditable(false);
- panel7.add(localDataPathTextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+ panel6.add(localDataPathTextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
exportDataButton = new JButton();
exportDataButton.setText("导出");
- panel7.add(exportDataButton, new GridConstraints(1, 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));
- final JPanel panel8 = new JPanel();
- panel8.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
- panel5.add(panel8, 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 panel9 = new JPanel();
- panel9.setLayout(new GridLayoutManager(2, 2, new Insets(0, 0, 0, 0), -1, -1));
- panel8.add(panel9, 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));
+ panel6.add(exportDataButton, new GridConstraints(1, 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));
+ final JPanel panel7 = new JPanel();
+ panel7.setLayout(new GridLayoutManager(2, 2, new Insets(10, 0, 0, 0), -1, -1));
+ panel5.add(panel7, 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("本地配置路径:");
- panel9.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));
+ panel7.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));
localConfigTextField = new JTextField();
localConfigTextField.setEditable(false);
- panel9.add(localConfigTextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+ panel7.add(localConfigTextField, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
exportConfigButton = new JButton();
exportConfigButton.setText("导出");
- panel9.add(exportConfigButton, new GridConstraints(1, 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));
+ panel7.add(exportConfigButton, new GridConstraints(1, 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));
+ final JPanel panel8 = new JPanel();
+ panel8.setLayout(new GridLayoutManager(3, 2, new Insets(10, 0, 0, 0), -1, -1));
+ panel5.add(panel8, 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 label4 = new JLabel();
+ label4.setText("图片助手路径:");
+ panel8.add(label4, 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 label5 = new JLabel();
+ Font label5Font = this.$$$getFont$$$(null, Font.BOLD, -1, label5.getFont());
+ if (label5Font != null) label5.setFont(label5Font);
+ label5.setText("*建议使用网盘对该路径进行同步备份");
+ panel8.add(label5, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
+ imagePathTextField = new JTextField();
+ imagePathTextField.setEditable(false);
+ panel8.add(imagePathTextField, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false));
+ openImageDirButton = new JButton();
+ openImageDirButton.setText("打开");
+ panel8.add(openImageDirButton, new GridConstraints(2, 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));
+ }
+
+ /**
+ * @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);
}
/**
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateDialog.java b/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateDialog.java
index 379a76bc..14936e0e 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateDialog.java
+++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateDialog.java
@@ -7,8 +7,13 @@
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
+import com.jayway.jsonpath.DocumentContext;
+import com.jayway.jsonpath.JsonPath;
import com.luoboduner.moo.tool.App;
+import com.luoboduner.moo.tool.ui.UiConsts;
import com.luoboduner.moo.tool.util.ComponentUtil;
+import com.luoboduner.moo.tool.util.SystemUtil;
+import org.apache.commons.lang3.StringUtils;
import javax.swing.*;
import java.awt.*;
@@ -77,7 +82,25 @@ public void downLoad(String newVersion) {
buttonOK.setEnabled(false);
ThreadUtil.execute(
() -> {
- String fileUrl = "http://download.zhoubochina.com/moo/exe/MooTool-" + newVersion + "-x64-Setup.exe";
+ String fileUrl = "";
+ // 从github获取最新版本相关信息
+ String downloadLinkInfo = HttpUtil.get(UiConsts.DOWNLOAD_LINK_INFO_URL);
+ if (StringUtils.isEmpty(downloadLinkInfo) || downloadLinkInfo.contains("404: Not Found")) {
+ JOptionPane.showMessageDialog(App.mainFrame,
+ "获取下载链接失败,请关注Gitee Release!", "网络错误",
+ JOptionPane.INFORMATION_MESSAGE);
+ return;
+ } else {
+ DocumentContext parse = JsonPath.parse(downloadLinkInfo);
+ if (SystemUtil.isWindowsOs()) {
+ fileUrl = parse.read("$.windows");
+ } else if (SystemUtil.isMacOs()) {
+ fileUrl = parse.read("$.mac");
+ } else if (SystemUtil.isLinuxOs()) {
+ fileUrl = parse.read("$.linux");
+ }
+ }
+
String fileName = FileUtil.getName(fileUrl);
URL url;
try {
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateInfoDialog.form b/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateInfoDialog.form
index 6c72d9af..e4af679a 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateInfoDialog.form
+++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateInfoDialog.form
@@ -67,7 +67,7 @@
-
+
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateInfoDialog.java b/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateInfoDialog.java
index 0b62c78d..d7b6d39c 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateInfoDialog.java
+++ b/src/main/java/com/luoboduner/moo/tool/ui/dialog/UpdateInfoDialog.java
@@ -5,9 +5,11 @@
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.SystemUtil;
import lombok.Getter;
import javax.swing.*;
+import javax.swing.border.TitledBorder;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
import java.awt.*;
@@ -66,19 +68,19 @@ public void windowClosing(WindowEvent e) {
}
private void onOK() {
-// if (SystemUtil.isMacOs()) {
+ if (SystemUtil.isMacOs()) {
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(new URI("https://gitee.com/zhoubochina/MooTool/releases"));
} catch (IOException | URISyntaxException ex) {
ex.printStackTrace();
}
-// } else {
-// UpdateDialog dialog = new UpdateDialog();
-// dialog.pack();
-// dialog.downLoad(newVersion);
-// dialog.setVisible(true);
-// }
+ } else {
+ UpdateDialog dialog = new UpdateDialog();
+ dialog.pack();
+ dialog.downLoad(newVersion);
+ dialog.setVisible(true);
+ }
dispose();
}
@@ -141,6 +143,7 @@ public void setHtmlText(String htmlText) {
contentPane.add(panel3, 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 JScrollPane scrollPane1 = new JScrollPane();
panel3.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));
+ scrollPane1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
textPane1 = new JTextPane();
textPane1.setEditable(false);
textPane1.setMargin(new Insets(80, 28, 3, 28));
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 047e44fe..d391d0ba 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
@@ -18,6 +18,8 @@
import com.luoboduner.moo.tool.util.SystemUtil;
import com.luoboduner.moo.tool.util.UndoUtil;
import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.exception.ExceptionUtils;
import org.fife.ui.rtextarea.Gutter;
import org.fife.ui.rtextarea.RTextScrollPane;
@@ -38,6 +40,7 @@
* @since 2019/9/7.
*/
@Getter
+@Slf4j
public class HostForm {
private JPanel hostPanel;
private JTable noteListTable;
@@ -71,6 +74,12 @@ public class HostForm {
public static final String MAC_HOST_FILE_PATH = "/etc/hosts";
+ public static final String LINUX_HOST_FILE_PATH = "/etc/hosts";
+
+ public static final String MAC_HOST_DIR_PATH = "/etc/";
+
+ public static final String LINUX_HOST_DIR_PATH = "/etc/";
+
public static final String NOT_SUPPORTED_TIPS = "暂不支持该操作系统!";
private HostSyntaxTextViewer textArea;
@@ -110,18 +119,47 @@ public static void setHost(String hostName, String hostText) {
highlightHostMenu(hostName);
}
} else if (SystemUtil.isMacOs()) {
- File hostFile = FileUtil.file(MAC_HOST_FILE_PATH);
- FileUtil.writeUtf8String(hostText, hostFile);
- if (App.trayIcon != null) {
- App.trayIcon.displayMessage("MooTool", "Host已切换!\n" + hostName, TrayIcon.MessageType.INFO);
- highlightHostMenu(hostName);
+ try {
+ File hostFile = FileUtil.file(MAC_HOST_FILE_PATH);
+ FileUtil.writeUtf8String(hostText, hostFile);
+ if (App.trayIcon != null) {
+ App.trayIcon.displayMessage("MooTool", "Host已切换!\n" + hostName, TrayIcon.MessageType.INFO);
+ highlightHostMenu(hostName);
+ }
+ } catch (Exception e) {
+ JOptionPane.showMessageDialog(hostForm.getHostPanel(), "需要管理员或root权限运行!\n现在帮你打开hosts文件所在目录,请自行修改替换" + e.getMessage(), "切换失败!", JOptionPane.ERROR_MESSAGE);
+ e.printStackTrace();
+ try {
+ Desktop desktop = Desktop.getDesktop();
+ desktop.open(new File(MAC_HOST_DIR_PATH));
+ } catch (Exception e2) {
+ log.error(ExceptionUtils.getStackTrace(e2));
+ }
+ }
+ } else if (SystemUtil.isLinuxOs()) {
+ try {
+ File hostFile = FileUtil.file(LINUX_HOST_FILE_PATH);
+ FileUtil.writeUtf8String(hostText, hostFile);
+ if (App.trayIcon != null) {
+ App.trayIcon.displayMessage("MooTool", "Host已切换!\n" + hostName, TrayIcon.MessageType.INFO);
+ highlightHostMenu(hostName);
+ }
+ } catch (Exception e) {
+ JOptionPane.showMessageDialog(hostForm.getHostPanel(), "需要管理员或root权限运行!\n现在帮你打开hosts文件所在目录,请自行修改替换" + e.getMessage(), "切换失败!", JOptionPane.ERROR_MESSAGE);
+ e.printStackTrace();
+ try {
+ Desktop desktop = Desktop.getDesktop();
+ desktop.open(new File(LINUX_HOST_DIR_PATH));
+ } catch (Exception e2) {
+ log.error(ExceptionUtils.getStackTrace(e2));
+ }
}
} else {
JOptionPane.showMessageDialog(hostForm.getHostPanel(), NOT_SUPPORTED_TIPS, "抱歉!", JOptionPane.INFORMATION_MESSAGE);
}
} catch (Exception ex) {
ex.printStackTrace();
- JOptionPane.showMessageDialog(hostForm.getHostPanel(), "需要管理员或root权限运行!\n\n" + ex.getMessage(), "切换失败!", JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(hostForm.getHostPanel(), ex.getMessage(), "切换失败!", JOptionPane.ERROR_MESSAGE);
} finally {
hostForm.getSwitchButton().setEnabled(true);
}
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/form/func/QuickNoteForm.form b/src/main/java/com/luoboduner/moo/tool/ui/form/func/QuickNoteForm.form
index faca8898..c1ea8e5c 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/form/func/QuickNoteForm.form
+++ b/src/main/java/com/luoboduner/moo/tool/ui/form/func/QuickNoteForm.form
@@ -356,7 +356,7 @@
-
+
@@ -543,6 +543,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/form/func/QuickNoteForm.java b/src/main/java/com/luoboduner/moo/tool/ui/form/func/QuickNoteForm.java
index 94a5f7b7..50f5393a 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/form/func/QuickNoteForm.java
+++ b/src/main/java/com/luoboduner/moo/tool/ui/form/func/QuickNoteForm.java
@@ -19,6 +19,7 @@
import org.fife.ui.rtextarea.RTextScrollPane;
import javax.swing.*;
+import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.util.List;
@@ -79,6 +80,8 @@ public class QuickNoteForm {
private JComboBox syntaxComboBox;
private JButton formatButton;
private JButton exportButton2;
+ private JLabel tipsLabel;
+ private JPanel indicatorPanel;
private static QuickNoteForm quickNoteForm;
private static TQuickNoteMapper quickNoteMapper = MybatisUtil.getSqlSession().getMapper(TQuickNoteMapper.class);
@@ -428,7 +431,7 @@ private static void getSysFontList() {
findMenuSeparator = new JSeparator();
findMenuSeparatorPanel.add(findMenuSeparator, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false));
final JPanel panel2 = new JPanel();
- panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));
+ panel2.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1));
controlPanel.add(panel2, 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_WANT_GROW, null, null, null, 0, true));
contentSplitPane = new JSplitPane();
contentSplitPane.setContinuousLayout(true);
@@ -496,6 +499,22 @@ private static void getSysFontList() {
panel4.add(spacer6, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
final JSeparator separator4 = new JSeparator();
panel3.add(separator4, new GridConstraints(14, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, 1, 1, null, null, null, 0, false));
+ indicatorPanel = new JPanel();
+ indicatorPanel.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
+ indicatorPanel.setAlignmentX(0.0f);
+ indicatorPanel.setAlignmentY(0.0f);
+ indicatorPanel.setFocusable(false);
+ indicatorPanel.setRequestFocusEnabled(false);
+ indicatorPanel.setVisible(false);
+ panel2.add(indicatorPanel, 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));
+ indicatorPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEmptyBorder(), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
+ tipsLabel = new JLabel();
+ tipsLabel.setFocusable(false);
+ tipsLabel.setRequestFocusEnabled(false);
+ tipsLabel.setText("");
+ indicatorPanel.add(tipsLabel, 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 spacer7 = new Spacer();
+ indicatorPanel.add(spacer7, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
}
/**
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/frame/MainFrame.java b/src/main/java/com/luoboduner/moo/tool/ui/frame/MainFrame.java
index a3b9a2ee..cee80849 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/frame/MainFrame.java
+++ b/src/main/java/com/luoboduner/moo/tool/ui/frame/MainFrame.java
@@ -20,6 +20,8 @@ public class MainFrame extends JFrame {
private static final long serialVersionUID = -332963894416012132L;
+ public static TopMenuBar topMenuBar;
+
public void init() {
this.setName(UiConsts.APP_NAME);
this.setTitle(UiConsts.APP_NAME);
@@ -33,7 +35,7 @@ public void init() {
// application.setEnabledPreferencesMenu(false);
// }
}
- TopMenuBar topMenuBar = TopMenuBar.getInstance();
+ topMenuBar = TopMenuBar.getInstance();
topMenuBar.init();
setJMenuBar(topMenuBar);
ComponentUtil.setPreferSizeAndLocateToCenter(this, 0.8, 0.88);
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/HostListener.java b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/HostListener.java
index 15201597..cd76e71a 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/HostListener.java
+++ b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/HostListener.java
@@ -396,7 +396,6 @@ public static void refreshHostContentInTextArea() {
hostForm.getTextArea().setCaretPosition(0);
hostForm.getScrollPane().getVerticalScrollBar().setValue(0);
hostForm.getScrollPane().getHorizontalScrollBar().setValue(0);
- hostForm.getTextArea().updateUI();
}
private static void save(boolean needRename) {
diff --git a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/QuickNoteListener.java b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/QuickNoteListener.java
index 5370b9ee..1a19648f 100644
--- a/src/main/java/com/luoboduner/moo/tool/ui/listener/func/QuickNoteListener.java
+++ b/src/main/java/com/luoboduner/moo/tool/ui/listener/func/QuickNoteListener.java
@@ -5,6 +5,7 @@
import cn.hutool.core.util.ReUtil;
import cn.hutool.json.JSONUtil;
import com.github.vertical_blank.sqlformatter.SqlFormatter;
+import com.github.vertical_blank.sqlformatter.languages.Dialect;
import com.google.common.collect.Lists;
import com.google.googlejavaformat.java.Formatter;
import com.luoboduner.moo.tool.App;
@@ -16,6 +17,7 @@
import com.luoboduner.moo.tool.ui.form.func.QuickNoteForm;
import com.luoboduner.moo.tool.ui.frame.FindResultFrame;
import com.luoboduner.moo.tool.util.MybatisUtil;
+import com.luoboduner.moo.tool.util.QuickNoteIndicatorTools;
import com.luoboduner.moo.tool.util.SqliteUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -623,6 +625,8 @@ public static void quickSave(boolean refreshModifiedTime) {
QuickNoteForm.initNoteListTable();
}
}
+
+ QuickNoteIndicatorTools.showTips("已保存:" + selectedName, QuickNoteIndicatorTools.TipsLevel.SUCCESS);
}
/**
@@ -736,6 +740,9 @@ public static String toThousandth(String value) {
return decimalFormat.format(number);
}
+ /**
+ * 文本格式化
+ */
public static void format() {
try {
QuickNoteForm quickNoteForm = QuickNoteForm.getInstance();
@@ -749,7 +756,37 @@ public static void format() {
switch (selectedSyntax) {
case SyntaxConstants.SYNTAX_STYLE_SQL:
- format = SqlFormatter.format(text);
+ switch (App.config.getSqlDialect()) {
+ case "MariaDB":
+ format = SqlFormatter.of(Dialect.MariaDb).format(text);
+ break;
+ case "MySQL":
+ format = SqlFormatter.of(Dialect.MySql).format(text);
+ break;
+ case "PostgreSQL":
+ format = SqlFormatter.of(Dialect.PostgreSql).format(text);
+ break;
+ case "IBM DB2":
+ format = SqlFormatter.of(Dialect.Db2).format(text);
+ break;
+ case "Oracle PL/SQL":
+ format = SqlFormatter.of(Dialect.PlSql).format(text);
+ break;
+ case "Couchbase N1QL":
+ format = SqlFormatter.of(Dialect.N1ql).format(text);
+ break;
+ case "Amazon Redshift":
+ format = SqlFormatter.of(Dialect.Redshift).format(text);
+ break;
+ case "Spark":
+ format = SqlFormatter.of(Dialect.SparkSql).format(text);
+ break;
+ case "SQL Server Transact-SQL":
+ format = SqlFormatter.of(Dialect.TSql).format(text);
+ break;
+ default:
+ format = SqlFormatter.of(Dialect.StandardSql).format(text);
+ }
break;
case SyntaxConstants.SYNTAX_STYLE_JSON:
case SyntaxConstants.SYNTAX_STYLE_JSON_WITH_COMMENTS:
@@ -773,6 +810,8 @@ public static void format() {
QuickNoteForm.quickNoteSyntaxTextViewerManager.getCurrentRSyntaxTextArea().setText(format);
QuickNoteForm.quickNoteSyntaxTextViewerManager.getCurrentRSyntaxTextArea().setCaretPosition(0);
+
+ QuickNoteIndicatorTools.showTips("已格式化:" + selectedName, QuickNoteIndicatorTools.TipsLevel.SUCCESS);
} catch (Exception e) {
JOptionPane.showMessageDialog(App.mainFrame, "格式化失败!\n\n" + e.getMessage(), "失败",
JOptionPane.ERROR_MESSAGE);
diff --git a/src/main/java/com/luoboduner/moo/tool/util/ConfigUtil.java b/src/main/java/com/luoboduner/moo/tool/util/ConfigUtil.java
index 0eede03c..2a8265c7 100644
--- a/src/main/java/com/luoboduner/moo/tool/util/ConfigUtil.java
+++ b/src/main/java/com/luoboduner/moo/tool/util/ConfigUtil.java
@@ -49,6 +49,11 @@ private ConfigUtil() {
*/
private String menuBarPosition;
+ /**
+ * sql dialect
+ */
+ private String sqlDialect;
+
/**
* 上次关闭前所在的tab
*/
@@ -342,6 +347,14 @@ public void setMenuBarPosition(String menuBarPosition) {
setting.putByGroup("menuBarPosition", "setting.custom", menuBarPosition);
}
+ public String getSqlDialect() {
+ return setting.getStr("sqlDialect", "setting.quickNote", "Standard SQL");
+ }
+
+ public void setSqlDialect(String sqlDialect) {
+ setting.putByGroup("sqlDialect", "setting.quickNote", sqlDialect);
+ }
+
public String getCalculatorInputExpress() {
return setting.getStr("calculatorInputExpress", "func.calculator", "3*(8-1)");
}
diff --git a/src/main/java/com/luoboduner/moo/tool/util/QuickNoteIndicatorTools.java b/src/main/java/com/luoboduner/moo/tool/util/QuickNoteIndicatorTools.java
new file mode 100644
index 00000000..83830b4b
--- /dev/null
+++ b/src/main/java/com/luoboduner/moo/tool/util/QuickNoteIndicatorTools.java
@@ -0,0 +1,46 @@
+package com.luoboduner.moo.tool.util;
+
+import cn.hutool.core.thread.ThreadUtil;
+import com.luoboduner.moo.tool.ui.form.func.QuickNoteForm;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * 随手记相关指标工具类
+ *
+ * @author Zhou Bo
+ * @since 2019/6/6.
+ */
+public class QuickNoteIndicatorTools {
+
+ public static void showTips(String tips, TipsLevel level) {
+ ThreadUtil.execute(() -> showTipsLockedMethod(tips, level));
+ }
+
+ private synchronized static void showTipsLockedMethod(String tips, TipsLevel level) {
+ QuickNoteForm quickNoteForm = QuickNoteForm.getInstance();
+ JPanel indicatorPanel = quickNoteForm.getIndicatorPanel();
+ JLabel tipsLabel = quickNoteForm.getTipsLabel();
+ if (TipsLevel.SUCCESS.equals(level)) {
+ indicatorPanel.setVisible(true);
+ tipsLabel.setForeground(TipsLevel.successColor());
+ tipsLabel.setText(tips);
+ }
+
+ ThreadUtil.safeSleep(1000);
+ tipsLabel.setText("");
+ indicatorPanel.setVisible(false);
+ }
+
+ public static enum TipsLevel {
+ INFO,
+ SUCCESS,
+ WARN,
+ ERROR;
+
+ public static Color successColor() {
+ return new Color(100, 197, 126);
+ }
+ }
+}
diff --git a/src/main/resources/version_summary.json b/src/main/resources/version_summary.json
index 46323fda..1f8c26a2 100644
--- a/src/main/resources/version_summary.json
+++ b/src/main/resources/version_summary.json
@@ -1,5 +1,5 @@
{
- "currentVersion": "v1.4.1",
+ "currentVersion": "v1.4.2",
"versionIndex": {
"v0.0.0": "0",
"v1.0.0": "1",
@@ -13,7 +13,8 @@
"v1.3.5": "9",
"v1.3.6": "10",
"v1.4.0": "11",
- "v1.4.1": "12"
+ "v1.4.1": "12",
+ "v1.4.2": "13"
},
"versionDetailList": [
{
@@ -80,6 +81,11 @@
"version": "v1.4.1",
"title": "随手记增加保存对应文本的语法类型",
"log": "● 随手记支持超链接内容识别和点击跳转\n● json格式化和host设置支持语法高亮\n● 调整应用启动时的线程逻辑\n● 调整随手记文本域视图逻辑\n● 随手记增加保存对应文本的语法类型\n● 新增配置和数据文件导出备份功能\n● 优化浅色主题下文本域和图标的表现\n● 修复一些bug\n"
+ },
+ {
+ "version": "v1.4.2",
+ "title": "随手记增加SQL、json、java的格式化功能",
+ "log": "● 随手记增加SQL、json、java的格式化功能\n● 优化macOS和linux下host设置\n● 随手记支持设置SQL方言\n● 增加图片备份及使用网盘同步的建议\n● 字体设置列表过长,可以转移到设置对话框进行设置\n● 随手记增加已保存提示\n● 检查更新后支持下载安装文件\n"
}
]
}
\ No newline at end of file