From d2d97234a366a5fd37b95cca0dd1075f1ddbd248 Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Mon, 10 Jun 2019 13:34:25 +0800 Subject: [PATCH 01/10] =?UTF-8?q?REPORT-17887=20=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=9C=80=E5=A4=A7=E5=80=BC=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E5=80=BC=E9=83=A8=E5=88=86=E5=9C=BA=E6=99=AF=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/NumberEditorValidatePane.java | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java index 78accb96b3..42bcfae0aa 100644 --- a/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java +++ b/designer-base/src/main/java/com/fr/design/widget/component/NumberEditorValidatePane.java @@ -9,13 +9,15 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; import com.fr.form.ui.NumberEditor; - import com.fr.stable.StringUtils; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JPanel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -23,6 +25,7 @@ import java.awt.event.ActionListener; * Created by kerry on 2017/9/10. */ public class NumberEditorValidatePane extends JPanel { + private UICheckBox allowDecimalsCheckBox; private UICheckBox allowNegativeCheckBox; private UICheckBox setMaxValueCheckBox; @@ -104,6 +107,7 @@ public class NumberEditorValidatePane extends JPanel { private void initListeners() { allowDecimalsListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (allowDecimalsCheckBox.isSelected()) { limitNumberPane.setVisible(true); @@ -129,8 +133,8 @@ public class NumberEditorValidatePane extends JPanel { if (!setMinValueCheckBox.isSelected()) { maxValueSpinner.getTextField().setMinValue(0.0); } - Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); - Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); + double minValue = Double.parseDouble("" + minValueSpinner.getValue()); + double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); if (minValue < 0.0) { minValueSpinner.setValue(0.0); } @@ -143,10 +147,11 @@ public class NumberEditorValidatePane extends JPanel { setMaxListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (setMaxValueCheckBox.isSelected()) { maxValueSpinner.setEnabled(true); - Double value = new Double(0); + Double value = (double) 0; if (setMinValueCheckBox.isSelected()) { Double minValue = Double.parseDouble("" + minValueSpinner.getValue()); if (minValue > value) { @@ -163,10 +168,11 @@ public class NumberEditorValidatePane extends JPanel { setMinListener = new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (setMinValueCheckBox.isSelected()) { minValueSpinner.setEnabled(true); - Double value = new Double(0); + Double value = (double) 0; if (setMaxValueCheckBox.isSelected()) { Double maxValue = Double.parseDouble("" + maxValueSpinner.getValue()); if (maxValue < value) { @@ -177,7 +183,7 @@ public class NumberEditorValidatePane extends JPanel { maxValueSpinner.getTextField().setMinValue(value); } else { minValueSpinner.setEnabled(false); - maxValueSpinner.getTextField().setMinValue(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : new Double(0)); + maxValueSpinner.getTextField().setMinValue(allowNegativeCheckBox.isSelected() ? (-Double.MAX_VALUE) : (double) 0); } } }; @@ -222,28 +228,28 @@ public class NumberEditorValidatePane extends JPanel { allowNegativeCheckBox.setSelected(e.isAllowNegative()); if (e.getMaxValue() == Double.MAX_VALUE) { setMaxValueCheckBox.setSelected(false); - maxValueSpinner.setValue(new Double(Double.MAX_VALUE)); + maxValueSpinner.setValue(Double.MAX_VALUE); maxValueSpinner.setEnabled(false); } else { setMaxValueCheckBox.setSelected(true); maxValueSpinner.setEnabled(true); - maxValueSpinner.setValue(new Double(e.getMaxValue())); + maxValueSpinner.setValue(e.getMaxValue()); } if (e.getMinValue() == -Double.MAX_VALUE) { setMinValueCheckBox.setSelected(false); - minValueSpinner.setValue(new Double(-Double.MAX_VALUE)); + minValueSpinner.setValue(-Double.MAX_VALUE); minValueSpinner.setEnabled(false); } else { setMinValueCheckBox.setSelected(true); minValueSpinner.setEnabled(true); - minValueSpinner.setValue(new Double(e.getMinValue())); + minValueSpinner.setValue(e.getMinValue()); } - if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ + if (setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()) { errorMsgTextFieldPane.setVisible(true); errorMsgTextField.setText(e.getRegErrorMessage()); - }else{ + } else { errorMsgTextFieldPane.setVisible(false); errorMsgTextField.setText(StringUtils.EMPTY); } @@ -259,15 +265,19 @@ public class NumberEditorValidatePane extends JPanel { if (setMinValueCheckBox.isSelected()) { ob.setMinValue(minValueSpinner.getValue()); + } else { + ob.setMinValue(-Double.MAX_VALUE); } if (setMaxValueCheckBox.isSelected()) { ob.setMaxValue(maxValueSpinner.getValue()); + } else { + ob.setMaxValue(Double.MAX_VALUE); } - if(setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()){ + if (setMinValueCheckBox.isSelected() || setMaxValueCheckBox.isSelected()) { errorMsgTextFieldPane.setVisible(true); - }else{ + } else { errorMsgTextFieldPane.setVisible(false); errorMsgTextField.setText(StringUtils.EMPTY); } From 6a7d8824b2d434746a68c4ec7ce0a52447496e05 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 11 Jun 2019 13:45:26 +0800 Subject: [PATCH 02/10] =?UTF-8?q?REPORT-17908=20=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=8A=A8=E7=94=BB=E2=80=9C=E5=88=9D=E5=A7=8B=E5=8C=96=E2=80=9D?= =?UTF-8?q?=E7=9A=84=E5=9B=BD=E9=99=85=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/SplashContext.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 441bf0f607..0c3199e417 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -26,6 +26,7 @@ public class SplashContext { public static final String SPLASH_PATH = getSplashPath(); public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf("/") + 1); private static final int FETCH_ONLINE_MAX_TIMES = 50; + private static final String THANKS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To"); private static final SplashContext SPLASH_CONTEXT = new SplashContext(); @@ -147,7 +148,7 @@ public class SplashContext { if (shouldShowThanks()) { tryFetchOnline(); if (StringUtils.isNotEmpty(guest)) { - updateThanksLog(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To") + guest); + updateThanksLog(THANKS + guest); } } } From 7d57de3d84bd3c97c2febae68a881e154d93a900 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 11 Jun 2019 13:59:34 +0800 Subject: [PATCH 03/10] update --- designer-realize/src/main/java/com/fr/start/SplashContext.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 0c3199e417..87a4237e0d 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -1,6 +1,7 @@ package com.fr.start; import com.fr.design.DesignerEnvManager; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.bbs.BBSConstants; import com.fr.event.Event; import com.fr.event.EventDispatcher; @@ -26,7 +27,7 @@ public class SplashContext { public static final String SPLASH_PATH = getSplashPath(); public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf("/") + 1); private static final int FETCH_ONLINE_MAX_TIMES = 50; - private static final String THANKS = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Thanks_To"); + private static final String THANKS = Toolkit.i18nText("Fine-Design_Report_Thanks_To"); private static final SplashContext SPLASH_CONTEXT = new SplashContext(); From 24f2f13bf442eb53d19938dd21716a509a24b1b2 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Mon, 17 Jun 2019 15:11:57 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=90=8D=E6=97=B6=E7=94=A8uuid=E4=BD=9C=E4=B8=BA=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/messagecollect/entity/FileEntityBuilder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java index c8ac3b32c0..28d6322c5b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java @@ -109,7 +109,7 @@ public class FileEntityBuilder { String filePath = FOCUS_POINT_FILE_ROOT_PATH + CoreConstants.SEPARATOR + today + CoreConstants.SEPARATOR + keyFileName; String bbsUserName = MarketConfig.getInstance().getBbsUsername(); String uuid = DesignerEnvManager.getEnvManager().getUUID(); - String name = bbsUserName == null ? uuid : bbsUserName; + String name = StringUtils.isEmpty(bbsUserName) ? uuid : bbsUserName; client.uploadFile(file, filePath, name, FILE_FROM); addMessageQueue(filePath, bbsUserName, uuid); From 3cf0d45159f5370dd9e5ce6bb0e882f65edf8c80 Mon Sep 17 00:00:00 2001 From: "alex.sung" Date: Tue, 18 Jun 2019 09:30:53 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B9=B1=E7=A0=81?= =?UTF-8?q?=E5=92=8C=E5=85=A5=E5=BA=93=E9=87=8D=E5=A4=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/FileEntityBuilder.java | 31 +------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java index 28d6322c5b..4497a0b28f 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/entity/FileEntityBuilder.java @@ -2,12 +2,9 @@ package com.fr.design.mainframe.messagecollect.entity; import com.fr.config.MarketConfig; import com.fr.design.DesignerEnvManager; -import com.fr.general.CloudCenter; import com.fr.general.CloudClient; import com.fr.general.IOUtils; -import com.fr.general.http.HttpToolbox; import com.fr.json.JSONArray; -import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.stable.CommonUtils; import com.fr.stable.CoreConstants; @@ -22,7 +19,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URLEncoder; -import java.util.HashMap; import java.util.UUID; /** @@ -32,11 +28,7 @@ import java.util.UUID; public class FileEntityBuilder { private static final String FOCUS_POINT_FILE_ROOT_PATH = "FocusPoint"; - private static final String FOCUS_POINT_FILE_UPLOAD_TOPIC = "__fine_intelli_file_upload__"; private static final String FILE_FROM = "design"; - private static final String FOCUS_POINT_FILE_UPLOAD_TYPE = "FocusPoint"; - private static final String FOCUS_POINT_FILE_UPLOAD_URL = CloudCenter.getInstance().acquireUrlByKind("design.feedback"); - private static final String FOCUS_POINT_URL_KEY = "focuspoint"; /** * 文件夹路径 @@ -111,27 +103,6 @@ public class FileEntityBuilder { String uuid = DesignerEnvManager.getEnvManager().getUUID(); String name = StringUtils.isEmpty(bbsUserName) ? uuid : bbsUserName; - client.uploadFile(file, filePath, name, FILE_FROM); - addMessageQueue(filePath, bbsUserName, uuid); - } - - private static void addMessageQueue(String filePath, String userName, String uuid) { - JSONObject uploadInfo = new JSONObject(FOCUS_POINT_FILE_UPLOAD_URL); - String focusPointUrl = uploadInfo.optString(FOCUS_POINT_URL_KEY); - try { - HashMap params = new HashMap<>(); - params.put("topic", FOCUS_POINT_FILE_UPLOAD_TOPIC); - params.put("username", URLEncoder.encode(userName, EncodeConstants.ENCODING_UTF_8)); - params.put("uuid", uuid); - params.put("filepath", filePath); - params.put("timestamp", String.valueOf(System.currentTimeMillis())); - params.put("signature", String.valueOf(CommonUtils.signature())); - params.put("type", FOCUS_POINT_FILE_UPLOAD_TYPE); - if(StringUtils.isNotEmpty(focusPointUrl)){ - HttpToolbox.post(focusPointUrl, params); - } - } catch (Exception e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + client.uploadFile(file, filePath, URLEncoder.encode(name, EncodeConstants.ENCODING_UTF_8), FILE_FROM); } } From a98259b93025cff9fcc6d8f8948b9c0e889de5e9 Mon Sep 17 00:00:00 2001 From: Hades Date: Fri, 21 Jun 2019 16:20:51 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E5=B0=86=E6=89=80=E6=9C=89=E6=B5=B7?= =?UTF-8?q?=E5=A4=96=E7=89=88=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=9A=84=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=9B=9E=E4=BC=A0=E5=8A=9F=E8=83=BD=E9=98=89=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/DesignerEnvManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index dcc588fa35..b50f38b73d 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -688,7 +688,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * @return 是否加入产品改良 */ public boolean isJoinProductImprove() { - return joinProductImprove; + return Locale.CHINA.equals(GeneralContext.getLocale()) && this.joinProductImprove; } /** From 4e218c7456bb1ab10da554b9d0bdb66eca8469dc Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 25 Jun 2019 10:08:53 +0800 Subject: [PATCH 07/10] =?UTF-8?q?KERNEL-582=20=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E5=AE=9A=E5=88=B6=E7=9A=84=E5=9C=B0=E6=96=B9=E4=BC=9A=E8=B6=8A?= =?UTF-8?q?=E6=9D=A5=E8=B6=8A=E5=A4=9A=EF=BC=8C=E6=83=B3=E5=8A=9E=E6=B3=95?= =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=BF=99=E7=A7=8Dif=20else=E5=86=99=E6=B3=95?= =?UTF-8?q?=20&&=20REPORT-18522=20=E5=B0=86=E6=89=80=E6=9C=89=E6=B5=B7?= =?UTF-8?q?=E5=A4=96=E7=89=88=E8=AE=BE=E8=AE=A1=E5=99=A8=E7=9A=84=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=9B=9E=E4=BC=A0=E5=8A=9F=E8=83=BD=E9=98=89=E5=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 6 +++- .../design/actions/community/VideoAction.java | 18 ++++------ .../locale/impl/ProductImproveMark.java | 31 ++++++++++++++++ .../com/fr/design/locale/impl/SplashMark.java | 35 ++++++++++++++++++ .../fr/design/locale/impl/UserInfoMark.java | 36 +++++++++++++++++++ .../com/fr/design/locale/impl/VideoMark.java | 35 ++++++++++++++++++ .../mainframe/toolbar/ToolBarMenuDock.java | 27 +++++++++----- .../start/CollectUserInformationDialog.java | 22 +++--------- .../main/java/com/fr/start/SplashContext.java | 14 +++----- 9 files changed, 176 insertions(+), 48 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/locale/impl/ProductImproveMark.java create mode 100644 designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java create mode 100644 designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java create mode 100644 designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index b50f38b73d..7370d4d55d 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -14,6 +14,7 @@ import com.fr.design.env.DesignerWorkspaceType; import com.fr.design.env.LocalDesignerWorkspaceInfo; import com.fr.design.env.RemoteDesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; +import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; @@ -23,6 +24,8 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogFormatter; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.general.xml.GeneralXMLTools; import com.fr.log.FineLoggerFactory; import com.fr.stable.CommonUtils; @@ -688,7 +691,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * @return 是否加入产品改良 */ public boolean isJoinProductImprove() { - return Locale.CHINA.equals(GeneralContext.getLocale()) && this.joinProductImprove; + LocaleMark localeMark = LocaleCenter.getMark(ProductImproveMark.class); + return localeMark.getValue() && this.joinProductImprove; } /** diff --git a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java index 4fabbd6da6..f3cb21bc70 100644 --- a/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/community/VideoAction.java @@ -1,16 +1,16 @@ package com.fr.design.actions.community; -import com.fr.base.BaseUtils; import com.fr.design.actions.UpdateAction; +import com.fr.design.locale.impl.VideoMark; import com.fr.design.menu.MenuKeySet; import com.fr.design.utils.BrowseUtils; -import com.fr.general.CloudCenter; -import com.fr.general.GeneralContext; import com.fr.general.IOUtils; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import javax.swing.*; import java.awt.event.ActionEvent; -import java.util.Locale; + public class VideoAction extends UpdateAction { @@ -27,14 +27,8 @@ public class VideoAction extends UpdateAction @Override public void actionPerformed(ActionEvent arg0) { - String url; - if (GeneralContext.getLocale().equals(Locale.US)) { - url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); - } else { - url = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); - } - BrowseUtils.browser(url); - + LocaleMark localeMark = LocaleCenter.getMark(VideoMark.class); + BrowseUtils.browser(localeMark.getValue()); } public static final MenuKeySet VIDEO = new MenuKeySet() { @Override diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/ProductImproveMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/ProductImproveMark.java new file mode 100644 index 0000000000..b7a05975cb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/ProductImproveMark.java @@ -0,0 +1,31 @@ +package com.fr.design.locale.impl; + +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author Hades + * @date 2019/6/24 + */ +public class ProductImproveMark implements LocaleMark { + + private Map map = new HashMap<>(); + + public ProductImproveMark() { + map.put(Locale.CHINA, true); + map.put(Locale.TAIWAN, false); + map.put(Locale.US, false); + map.put(Locale.KOREA, false); + map.put(Locale.JAPAN, false); + } + + @Override + public Boolean getValue() { + Boolean result = map.get(GeneralContext.getLocale()); + return result == null ? false : result; + } +} diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java new file mode 100644 index 0000000000..790108978f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/SplashMark.java @@ -0,0 +1,35 @@ +package com.fr.design.locale.impl; + +import com.fr.design.DesignerEnvManager; +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author Hades + * @date 2019/6/24 + */ +public class SplashMark implements LocaleMark { + + private Map map = new HashMap(); + private static final String SPLASH_PATH = "/com/fr/design/images/splash_10.gif"; + private static final String SPLASH_EN_PATH = "/com/fr/design/images/splash_10_en.gif"; + private static final String SPLASH_JP_PATH = "/com/fr/design/images/splash_10_jp.gif"; + + public SplashMark() { + map.put(Locale.CHINA, SPLASH_PATH); + map.put(Locale.KOREA, SPLASH_EN_PATH); + map.put(Locale.JAPAN, SPLASH_JP_PATH); + map.put(Locale.US, SPLASH_EN_PATH); + map.put(Locale.TAIWAN, SPLASH_EN_PATH); + } + + @Override + public String getValue() { + String result = map.get(DesignerEnvManager.getEnvManager().getLanguage()); + return result == null ? SPLASH_EN_PATH : result; + } +} diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java new file mode 100644 index 0000000000..3739c49f6a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/UserInfoMark.java @@ -0,0 +1,36 @@ +package com.fr.design.locale.impl; + +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author Hades + * @date 2019/6/24 + */ +public class UserInfoMark implements LocaleMark { + + private Map map = new HashMap<>(); + private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn"); + private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); + private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); + private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); + + public UserInfoMark() { + map.put(Locale.CHINA, CN_LOGIN_HTML); + map.put(Locale.KOREA, EN_LOGIN_HTML); + map.put(Locale.JAPAN, JP_LOGIN_HTML); + map.put(Locale.US, EN_LOGIN_HTML); + map.put(Locale.TAIWAN, TW_LOGIN_HTML); + } + + @Override + public String getValue() { + String result = map.get(GeneralContext.getLocale()); + return result == null ? EN_LOGIN_HTML : result; + } +} diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java b/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java new file mode 100644 index 0000000000..2071faba3f --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java @@ -0,0 +1,35 @@ +package com.fr.design.locale.impl; + +import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleMark; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +/** + * @author Hades + * @date 2019/6/24 + */ +public class VideoMark implements LocaleMark { + + private Map map = new HashMap<>(); + private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); + private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); + private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.tw"); + + public VideoMark() { + map.put(Locale.CHINA, VIDEO_CN); + map.put(Locale.KOREA, VIDEO_EN); + map.put(Locale.JAPAN, VIDEO_EN); + map.put(Locale.US, VIDEO_EN); + map.put(Locale.TAIWAN, VIDEO_TW); + } + + @Override + public String getValue() { + String result = map.get(GeneralContext.getLocale()); + return result == null ? VIDEO_EN : result; + } +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index 7e0d6b3597..bd7bd0a2ad 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -58,6 +58,9 @@ import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.utils.ThemeUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleAction; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.impl.SupportLocaleImpl; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; @@ -240,7 +243,7 @@ public abstract class ToolBarMenuDock { public MenuDef[] menus(final ToolBarMenuDockPlus plus) { //删除之前创建的插件菜单监听 clearPluginListeners(); - java.util.List menuList = new java.util.ArrayList(); + final java.util.List menuList = new java.util.ArrayList(); // 添加文件菜单 menuList.add(createFileMenuDef(plus)); @@ -258,10 +261,13 @@ public abstract class ToolBarMenuDock { // 添加帮助菜单 menuList.add(createHelpMenuDef()); - if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)) { - // 添加社区菜单 - addCommunityMenuDef(menuList); - } + LocaleCenter.buildAction(new LocaleAction() { + @Override + public void execute() { + addCommunityMenuDef(menuList); + } + }, SupportLocaleImpl.COMMUNITY); + // 添加全部UpdateAction到actionmanager中 addAllUpdateActionsToList(menuList); @@ -532,7 +538,7 @@ public abstract class ToolBarMenuDock { * @return 社区菜单的子菜单 */ public ShortCut[] createCommunityShortCuts() { - java.util.List shortCuts = new ArrayList(); + final java.util.List shortCuts = new ArrayList(); shortCuts.add(new BBSAction()); shortCuts.add(new VideoAction()); shortCuts.add(new TutorialAction()); @@ -543,9 +549,12 @@ public abstract class ToolBarMenuDock { shortCuts.add(new CusDemandAction()); shortCuts.add(new CenterAction()); shortCuts.add(new SignAction()); - if (Locale.TAIWAN.equals(GeneralContext.getLocale())) { - shortCuts.add(new FacebookFansAction()); - } + LocaleCenter.buildAction(new LocaleAction() { + @Override + public void execute() { + shortCuts.add(new FacebookFansAction()); + } + }, SupportLocaleImpl.FACEBOOK); return shortCuts.toArray(new ShortCut[shortCuts.size()]); } diff --git a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java index c32c2307d2..139030642c 100644 --- a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java +++ b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java @@ -8,11 +8,14 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextarea.DescriptionTextArea; import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.locale.impl.UserInfoMark; import com.fr.design.mainframe.ActiveKeyGenerator; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import javax.swing.*; import javax.swing.border.TitledBorder; @@ -31,11 +34,6 @@ public class CollectUserInformationDialog extends UIDialog { private static final int ONLINE_VERIFY_TIMEOUT = 30 * 1000; - private static final String CN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.cn"); - private static final String EN_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.en"); - private static final String TW_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.tw"); - private static final String JP_LOGIN_HTML = CloudCenter.getInstance().acquireUrlByKind("frlogin.jp"); - private UITextField keyTextField; private ActionListener actionListener = new ActionListener() { @@ -129,19 +127,9 @@ public class CollectUserInformationDialog extends UIDialog { private void getKeyAction() { - Locale locale = GeneralContext.getLocale(); - String url = EN_LOGIN_HTML; - if (ComparatorUtils.equals(locale, Locale.TAIWAN)) { - url = TW_LOGIN_HTML; - } - if (ComparatorUtils.equals(locale, Locale.CHINA)) { - url = CN_LOGIN_HTML; - } - if (ComparatorUtils.equals(locale, Locale.JAPAN)) { - url = JP_LOGIN_HTML; - } + LocaleMark localeMark = LocaleCenter.getMark(UserInfoMark.class); try { - Desktop.getDesktop().browse(new URI(url)); + Desktop.getDesktop().browse(new URI(localeMark.getValue())); } catch (Exception ignored) { } diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index 87a4237e0d..ab358e8d71 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -1,12 +1,14 @@ package com.fr.start; -import com.fr.design.DesignerEnvManager; import com.fr.design.i18n.Toolkit; +import com.fr.design.locale.impl.SplashMark; import com.fr.design.mainframe.bbs.BBSConstants; import com.fr.event.Event; import com.fr.event.EventDispatcher; import com.fr.event.Listener; import com.fr.general.GeneralContext; +import com.fr.general.locale.LocaleCenter; +import com.fr.general.locale.LocaleMark; import com.fr.module.ModuleEvent; import com.fr.stable.StringUtils; @@ -168,13 +170,7 @@ public class SplashContext { } private static String getSplashPath() { - Locale locale = DesignerEnvManager.getEnvManager().getLanguage(); - if (Locale.US.equals(locale) || Locale.KOREA.equals(locale) || Locale.TAIWAN.equals(locale)) { - return "/com/fr/design/images/splash_10_en.gif"; - } else if (Locale.JAPAN.equals(locale)) { - return "/com/fr/design/images/splash_10_jp.gif"; - } else { - return "/com/fr/design/images/splash_10.gif"; - } + LocaleMark localeMark = LocaleCenter.getMark(SplashMark.class); + return localeMark.getValue(); } } \ No newline at end of file From 70184cdb0fae354577424e76f6d8c00a4b979649 Mon Sep 17 00:00:00 2001 From: Hades Date: Tue, 25 Jun 2019 10:46:03 +0800 Subject: [PATCH 08/10] update --- .../design/locale/impl/SupportLocaleImpl.java | 44 +++++++++++++++++++ .../mainframe/toolbar/ToolBarMenuDock.java | 2 +- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java diff --git a/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java b/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java new file mode 100644 index 0000000000..61de25937c --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/locale/impl/SupportLocaleImpl.java @@ -0,0 +1,44 @@ +package com.fr.design.locale.impl; + +import com.fr.general.locale.SupportLocale; + +import java.util.HashSet; +import java.util.Locale; +import java.util.Set; + +/** + * 某些国际化环境支持的操作 + * 需要增加/删除支持的语言 统一在这里修改 无须改动业务代码 + * 后续有新的不同语言下的差异操作 添加新的枚举 + * @author Hades + * @date 2019/6/24 + */ +public enum SupportLocaleImpl implements SupportLocale { + + /** + * 社区菜单支持的国际化环境 + */ + COMMUNITY { + @Override + public Set support() { + Set set = new HashSet(); + set.add(Locale.CHINA); + set.add(Locale.TAIWAN); + return set; + } + }, + + /** + * Facebook支持的国际化环境 + */ + FACEBOOK { + @Override + public Set support() { + Set set = new HashSet(); + set.add(Locale.TAIWAN); + return set; + } + } + + +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index bd7bd0a2ad..8a739f54f1 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -60,7 +60,7 @@ import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; import com.fr.general.locale.LocaleAction; import com.fr.general.locale.LocaleCenter; -import com.fr.general.locale.impl.SupportLocaleImpl; +import com.fr.design.locale.impl.SupportLocaleImpl; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; From cb3f74bc8aabbb304ef8b5d6b5b204838fc59e9c Mon Sep 17 00:00:00 2001 From: Hades Date: Wed, 3 Jul 2019 11:46:13 +0800 Subject: [PATCH 09/10] =?UTF-8?q?REPORT-18955=20=E5=A1=AB=E6=8A=A5?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E9=85=8D=E7=BD=AE=EF=BC=8C=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E7=9A=84=E5=88=A0=E9=99=A4=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=81=B0=E8=89=B2=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/write/submit/DBManipulationPane.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java index 2e36ea5d8a..6692155dce 100644 --- a/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java +++ b/designer-base/src/main/java/com/fr/design/write/submit/DBManipulationPane.java @@ -279,7 +279,12 @@ public class DBManipulationPane extends BasicBeanPane { addSubmitConditionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - final DSColumnLiteConditionPane conditionPane = new DSColumnLiteConditionPane(); + final DSColumnLiteConditionPane conditionPane = new DSColumnLiteConditionPane() { + @Override + protected boolean isNeedDoWithCondition(Condition liteCondition) { + return liteCondition != null; + } + }; String[] columns = chooseTable.currentColumnNames(); if (columns != null && columns.length > 0) { conditionPane.populateColumns(chooseTable.currentColumnNames()); From faf998dfd801179b578630f131ea7261895a57bc Mon Sep 17 00:00:00 2001 From: Lanlan Date: Wed, 3 Jul 2019 15:30:00 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E5=86=85=E5=AD=98=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=8E=A8=E8=8D=90=EF=BC=9A=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E6=8F=92=E4=BB=B6=E9=9A=8Flic=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/extra/PluginUtils.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java index 92a8388647..98e6a75311 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginUtils.java @@ -233,6 +233,8 @@ public class PluginUtils { jo.put("onTrial", pluginContext.isOnTrial()); jo.put("deadline", getDeadline(pluginContext)); jo.put("registerFailed", pluginContext.isRegisterFailed()); + jo.put("selfState", pluginContext.getSelfState()); + jo.put("switchedReason", pluginContext.getSwitchedReason()); ja.put(jo); } }catch (Exception e){