Browse Source

REPORT-20516 语言切换至英文,创建条件属性、超级链接,点击删除,对话框的“确认”和“取消”显示为中文

feature/big-screen
Joe.Jiang 5 years ago committed by Joe.Jiang
parent
commit
311dc682a1
  1. 114
      designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java
  2. 4
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java
  3. 2
      designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java
  4. 2
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java
  5. 4
      designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java
  6. 2
      designer-base/src/main/java/com/fr/design/extra/tradition/callback/UpdateOnlineCallback.java

114
designer-base/src/main/java/com/fr/design/dialog/FineJOptionPane.java

@ -4,6 +4,8 @@ import javax.swing.Icon;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import java.awt.Component; import java.awt.Component;
import java.awt.HeadlessException; import java.awt.HeadlessException;
import java.util.HashMap;
import java.util.Map;
/** /**
* @author Joe * @author Joe
@ -12,42 +14,82 @@ import java.awt.HeadlessException;
*/ */
public class FineJOptionPane extends JOptionPane { public class FineJOptionPane extends JOptionPane {
private final static String[] OPTION_DEFAULT = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK") }; public final static String[] OPTION_DEFAULT = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK") };
private final static String[] OPTION_YES_NO = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"), public final static String[] OPTION_YES_NO = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No") }; com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No") };
private final static String[] OPTION_YES_NO_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"), public final static String[] OPTION_YES_NO_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Yes"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") }; com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") };
private final static String[] OPTION_OK_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK"), public final static String[] OPTION_OK_CANCEL = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_OK"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") }; com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel") };
//这里用一个二维数组,根据optionType为具体的按钮建立索引 //选项类型optionType 和 选项字符串数组 一一对应
private final static String[][] OPTIONS_ARRAY = {OPTION_DEFAULT, OPTION_YES_NO, OPTION_YES_NO_CANCEL, OPTION_OK_CANCEL}; private final static Map<Integer, String[]> OPTION_MAP = new HashMap<>();
static {
OPTION_MAP.put(DEFAULT_OPTION, OPTION_DEFAULT);
OPTION_MAP.put(YES_NO_OPTION, OPTION_YES_NO);
OPTION_MAP.put(YES_NO_CANCEL_OPTION, OPTION_YES_NO_CANCEL);
OPTION_MAP.put(OK_CANCEL_OPTION, OPTION_OK_CANCEL);
}
//默认标题
private final static String MESSAGE_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message"); private final static String MESSAGE_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Message");
private final static String CONFIRM_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm"); private final static String CONFIRM_DIALOG_TITLE = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Confirm");
//重写所有showMessageDialog方法 /**
* 使用默认 标题 消息类型 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message) public static void showMessageDialog(Component parentComponent, Object message)
throws HeadlessException { throws HeadlessException {
showMessageDialog(parentComponent, message, MESSAGE_DIALOG_TITLE, showMessageDialog(parentComponent, message, MESSAGE_DIALOG_TITLE,
INFORMATION_MESSAGE); INFORMATION_MESSAGE);
} }
/**
* 使用默认 Icon 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param messageType 消息类型
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message, public static void showMessageDialog(Component parentComponent, Object message,
String title, int messageType) String title, int messageType)
throws HeadlessException { throws HeadlessException {
showMessageDialog(parentComponent, message, title, messageType, null); showMessageDialog(parentComponent, message, title, messageType, null);
} }
/**
* 使用默认 选项类型选项 初始选项 的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param messageType 消息类型
* @param icon 图标
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message, public static void showMessageDialog(Component parentComponent, Object message,
String title, int messageType, Icon icon) String title, int messageType, Icon icon)
throws HeadlessException { throws HeadlessException {
showMessageDialog(parentComponent, message, title, DEFAULT_OPTION, showMessageDialog(parentComponent, message, title, DEFAULT_OPTION,
messageType, icon, OPTIONS_ARRAY[0], null); messageType, icon, OPTION_DEFAULT, null);
} }
/**
* 完全自定义的消息提示弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @param icon 图标
* @param options 选项
* @param initialValue 初始选项
* @throws HeadlessException
*/
public static void showMessageDialog(Component parentComponent, Object message, public static void showMessageDialog(Component parentComponent, Object message,
String title, int optionType, int messageType, String title, int optionType, int messageType,
Icon icon, Object[] options, Object initialValue) Icon icon, Object[] options, Object initialValue)
@ -56,8 +98,12 @@ public class FineJOptionPane extends JOptionPane {
messageType, icon, options, initialValue); messageType, icon, options, initialValue);
} }
/**
//重写所有showConfirmDialog方法 * 使用默认 标题 选项类型 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message) public static int showConfirmDialog(Component parentComponent, Object message)
throws HeadlessException { throws HeadlessException {
return showConfirmDialog(parentComponent, message, return showConfirmDialog(parentComponent, message,
@ -65,12 +111,29 @@ public class FineJOptionPane extends JOptionPane {
YES_NO_CANCEL_OPTION); YES_NO_CANCEL_OPTION);
} }
/**
* 使用默认 消息类型 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message, public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType) throws HeadlessException { String title, int optionType) throws HeadlessException {
return showConfirmDialog(parentComponent, message, title, optionType, return showConfirmDialog(parentComponent, message, title, optionType,
QUESTION_MESSAGE); QUESTION_MESSAGE);
} }
/**
* 使用默认 Icon 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message, public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType, int messageType) String title, int optionType, int messageType)
throws HeadlessException { throws HeadlessException {
@ -78,20 +141,41 @@ public class FineJOptionPane extends JOptionPane {
messageType, null); messageType, null);
} }
//第一个方法,可以根据提供的optionType找到对应的国际化字符串;第二个方法,给使用者提供灵活性 /**
* 根据 选项类型 获取对应 选项 且使用默认 初始选项 的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @param icon 图标
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message, public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType, int messageType, Icon icon) String title, int optionType, int messageType, Icon icon)
throws HeadlessException { throws HeadlessException {
return showConfirmDialog(parentComponent, message, title, optionType, return showConfirmDialog(parentComponent, message, title, optionType,
messageType, icon, OPTIONS_ARRAY[optionType + 1], null); messageType, icon, OPTION_MAP.get(optionType), null);
} }
/**
* 完全自定义的确认弹出框
* @param parentComponent 父容器
* @param message 具体的提示消息
* @param title 标题
* @param optionType 选项类型
* @param messageType 消息类型
* @param icon 图标
* @param options 选项
* @param initialValue 初始选项
* @throws HeadlessException
*/
public static int showConfirmDialog(Component parentComponent, Object message, public static int showConfirmDialog(Component parentComponent, Object message,
String title, int optionType, int messageType, Icon icon, String title, int optionType, int messageType, Icon icon,
Object[] objects, Object initialValue) Object[] options, Object initialValue)
throws HeadlessException { throws HeadlessException {
return showOptionDialog(parentComponent, message, title, optionType, return showOptionDialog(parentComponent, message, title, optionType,
messageType, icon, objects, initialValue); messageType, icon, options, initialValue);
} }

4
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java

@ -51,7 +51,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -71,7 +71,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {

2
designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java

@ -48,7 +48,7 @@ public class InstallOnlineCallback extends AbstractDealPreTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {

2
designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java

@ -37,7 +37,7 @@ public class UninstallPluginCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {

4
designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java

@ -49,7 +49,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {
@ -69,7 +69,7 @@ public class UpdateFromDiskCallback extends AbstractPluginTaskCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.NO_OPTION || rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {

2
designer-base/src/main/java/com/fr/design/extra/tradition/callback/UpdateOnlineCallback.java

@ -42,7 +42,7 @@ public class UpdateOnlineCallback implements ProgressCallback {
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.YES_NO_CANCEL_OPTION,
JOptionPane.INFORMATION_MESSAGE, JOptionPane.INFORMATION_MESSAGE,
null, null,
null, FineJOptionPane.OPTION_YES_NO_CANCEL,
null null
); );
if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) { if (rv == JOptionPane.CANCEL_OPTION || rv == JOptionPane.CLOSED_OPTION) {

Loading…
Cancel
Save