From fc78087cc544a2f55c4661cbdf64a5cff3e7028a Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 31 Jul 2018 11:21:34 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-10160=2010.0=E5=86=92=E7=83=9F=20Mac?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=90=AF=E5=8A=A8,=20=E5=AD=97?= =?UTF-8?q?=E4=BD=93=E7=B3=8A=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer-realize/src/main/java/com/fr/start/Designer.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 29e84d031a..e4c119f7d5 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -150,11 +150,6 @@ public class Designer extends BaseDesigner { private static SplashStrategy createSplash() { // 这里可以开接口加载自定义启动画面 - if (OperatingSystem.isWindows()) { - return new SplashFx(); - } else if (OperatingSystem.isMacOS()) { - return new SplashMac(); - } return new SplashFx(); } From 2ae7e2a073619cca9fce3df9eea8eed5c85bd408 Mon Sep 17 00:00:00 2001 From: ju Date: Tue, 31 Jul 2018 14:17:04 +0800 Subject: [PATCH 2/5] =?UTF-8?q?REPORT-9652=20=E4=BC=98=E5=8C=96=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E5=87=8F=E5=B0=91RPC=E5=92=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E8=AE=BF=E9=97=AE=E6=AC=A1=E6=95=B0=20?= =?UTF-8?q?=E3=80=9010.0=E4=BA=8C=E8=BD=AE=E5=9B=9E=E5=BD=92=E3=80=91?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E9=9B=86=E6=88=90-=E9=9B=86=E7=BE=A4-?= =?UTF-8?q?=E5=A4=A7=E6=95=B0=E6=8D=AE=E9=87=8F=E6=A8=A1=E6=9D=BF=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=97=B6=E6=96=87=E4=BB=B6=E5=A4=B9=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/gui/itree/filetree/TemplateFileTree.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java index 4ac6141c7e..862aff3796 100644 --- a/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java +++ b/designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java @@ -179,8 +179,9 @@ public class TemplateFileTree extends EnvFileTree { @Override protected ExpandMutableTreeNode[] loadChildTreeNodes(ExpandMutableTreeNode treeNode) { + FileNode[] fnArray = listFileNodes(treeNode); - + return fileNodeArray2TreeNodeArray(fnArray); } @@ -189,13 +190,14 @@ public class TemplateFileTree extends EnvFileTree { */ private ExpandMutableTreeNode[] fileNodeArray2TreeNodeArray(FileNode[] fileNodes) { boolean isLocal = WorkContext.getCurrent().isLocal(); + boolean isRoot = WorkContext.getCurrent().isRoot(); ExpandMutableTreeNode[] res = new ExpandMutableTreeNode[fileNodes.length]; for (int i = 0; i < res.length; i++) { FileNode fn = fileNodes[i]; res[i] = new ExpandMutableTreeNode(fn); if (fn.isDirectory()) { res[i].add(new ExpandMutableTreeNode()); - if (isLocal || WorkContext.getCurrent().isRoot()) { + if (isLocal || isRoot) { res[i].setFullAuthority(true); } else { boolean hasFullAuthority = isContained(fn); @@ -203,7 +205,6 @@ public class TemplateFileTree extends EnvFileTree { } } } - return res; } @@ -269,6 +270,7 @@ public class TemplateFileTree extends EnvFileTree { * 求当前TreeNode下所有的FileNode. */ private FileNode[] listFileNodes(ExpandMutableTreeNode currentTreeNode) { + if (currentTreeNode == null) { return new FileNode[0]; } @@ -276,6 +278,7 @@ public class TemplateFileTree extends EnvFileTree { Object object = currentTreeNode.getUserObject(); if (object instanceof FileNode) { + return this.listFileNodes(((FileNode) object).getEnvPath()); } From 3f1cec83e442ad5eae2da31de240199cc2309e51 Mon Sep 17 00:00:00 2001 From: plough Date: Tue, 31 Jul 2018 14:32:21 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E5=90=8E=EF=BC=8C=E6=B0=B4=E5=8D=B0=E9=94=99=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/mainframe/FormDesignerUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index 0f1ccf33ce..6e075f7338 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java @@ -115,7 +115,7 @@ public class FormDesignerUI extends ComponentUI { private void paintWatermark(Graphics2D g) { WatermarkAttr watermark = ReportUtils.getWatermarkFromAttrMarkFile(designer.getTarget()); WatermarkPainter painter = WatermarkPainter.createPainter(watermark, designer.getResolution()); - painter.paint(g, 0, designer.getParaHeight(), designer.getArea().getBounds()); + painter.paint(g, 0, 0, designer.getArea().getBounds()); } private int[] getActualLine(int i) { From 9ab8e82ada52be5efd7c8201399fbdd362e733a9 Mon Sep 17 00:00:00 2001 From: richie Date: Tue, 31 Jul 2018 14:36:09 +0800 Subject: [PATCH 4/5] =?UTF-8?q?CORE-116=20=E7=BB=A7=E7=BB=AD=E6=94=B9?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 130 +++++++++--------- .../design/actions/community/VideoAction.java | 4 +- .../design/actions/file/PreferencePane.java | 84 ++++------- .../design/actions/file/SwitchExistEnv.java | 5 +- .../com/fr/design/actions/help/AboutPane.java | 30 ++-- .../design/actions/help/TutorialAction.java | 3 +- .../fr/design/editor/editor/DateEditor.java | 8 +- .../com/fr/design/formula/FormulaPane.java | 3 +- .../com/fr/design/formula/FunctionNAD.java | 48 +++---- .../com/fr/design/mainframe/TemplatePane.java | 2 + .../mainframe/toolbar/ToolBarMenuDock.java | 7 +- .../java/com/fr/design/utils/DesignUtils.java | 2 +- .../com/fr/design/DesignerEnvManagerTest.java | 23 +--- .../actions/help/TutorialActionTest.java | 11 +- .../start/CollectUserInformationDialog.java | 15 +- .../main/java/com/fr/start/SplashContext.java | 5 +- .../fr/start/module/PreStartActivator.java | 2 +- 17 files changed, 167 insertions(+), 215 deletions(-) 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 60ce965044..13b95f8f4f 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -22,10 +22,9 @@ import com.fr.general.ComparatorUtils; import com.fr.general.FRLogFormatter; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; -import com.fr.general.Inter; import com.fr.general.xml.GeneralXMLTools; -import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; +import com.fr.stable.CommonUtils; import com.fr.stable.Constants; import com.fr.stable.EnvChangedListener; import com.fr.stable.ListMap; @@ -43,10 +42,9 @@ import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.connect.AuthException; -import javax.swing.SwingWorker; +import javax.swing.*; import javax.swing.SwingWorker.StateValue; -import java.awt.Color; -import java.awt.Rectangle; +import java.awt.*; import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; @@ -111,7 +109,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private Color paginationLineColor = Color.black; // line color of paper private boolean supportCellEditorDef = false; private boolean isDragPermited = false; - private int language; + private Locale language = Locale.SIMPLIFIED_CHINESE; //2014-8-26默认显示全部, 因为以前的版本, 虽然是false, 实际上是显示所有表, 因此这边要兼容 private boolean useOracleSystemSpace = true; private int cachingTemplateLimit = CACHINGTEMPLATE_LIMIT; @@ -502,7 +500,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { * 返回默认环境 */ public DesignerWorkspaceInfo getDefaultConfig() { - String installHome = StableUtils.getInstallHome(); + String installHome = StableUtils.getInstallHome(); String defaultenvPath = getDefaultenvPath(installHome); defaultenvPath = new File(defaultenvPath).getPath(); Iterator> entryIt = nameEnvMap.entrySet().iterator(); @@ -554,7 +552,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } try { final String envName = getDefaultEnvName(); - WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig()),new WorkContextCallback() { + WorkContext.switchTo(DesignerWorkspaceGenerator.generate(getDefaultConfig()), new WorkContextCallback() { @Override public void done() { @@ -713,37 +711,15 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { /** * 返回语言类型 */ - public int getLanguage() { - return this.language; - } - - /** - * 返回语言类型 - */ - public Locale getLocale() { - // 性能 - if (language <= 1) { - return Locale.CHINA; - } - Locale[] locales = supportLocale(); - if (language <= locales.length) { - return locales[language - 1]; - } - return Locale.CHINA; - } - - // 当前系统支持的语言 - protected Locale[] supportLocale() { - Inter.getInstance(); - Map languageMap = InterProviderFactory.getProvider().getSupportLocaleMap(); - return languageMap.keySet().toArray(new Locale[languageMap.size()]); + public Locale getLanguage() { + return language; } /** * 设置语言参数 */ - public void setLanguage(int i) { - this.language = i; + public void setLanguage(Locale locale) { + this.language = locale; } /** @@ -1310,7 +1286,34 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private void readLanguage(XMLableReader reader) { String tmpVal; if ((tmpVal = reader.getElementValue()) != null) { - this.setLanguage(Integer.parseInt(tmpVal)); + if (!CommonUtils.isNumber(tmpVal)) { + setLanguage(CommonUtils.stringToLocale(tmpVal)); + } else { + // 用于兼容10.0之前的版本 + int value = Integer.parseInt(tmpVal); + switch (value) { + case 0: + setLanguage(Locale.SIMPLIFIED_CHINESE); + break; + case 1: + setLanguage(Locale.US); + break; + case 2: + setLanguage(Locale.JAPAN); + break; + case 3: + setLanguage(Locale.TRADITIONAL_CHINESE); + break; + case 4: + setLanguage(Locale.KOREA); + break; + case 5: + setLanguage(new Locale("pt", "PT")); + break; + default: + setLanguage(Locale.SIMPLIFIED_CHINESE); + } + } } } @@ -1368,6 +1371,34 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { reader.readXMLObject(this.configManager); } + public String getUUID() { + return StringUtils.isEmpty(uuid) ? UUID.randomUUID().toString() : uuid; + } + + public int getActiveKeyStatus() { + return activeKeyStatus; + } + + public void setActiveKeyStatus(int activeKeyStatus) { + this.activeKeyStatus = activeKeyStatus; + } + + public AlphaFineConfigManager getAlphaFineConfigManager() { + return alphaFineConfigManager; + } + + public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) { + this.alphaFineConfigManager = alphaFineConfigManager; + } + + public boolean isImageCompress() { + return imageCompress; + } + + public void setImageCompress(boolean imageCompress) { + this.imageCompress = imageCompress; + } + /** * Read XML.
* The method will be invoked when read data from XML file.
@@ -1640,17 +1671,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } } - public String getUUID() { - return StringUtils.isEmpty(uuid) ? UUID.randomUUID().toString() : uuid; - } - - public int getActiveKeyStatus() { - return activeKeyStatus; - } - - public void setActiveKeyStatus(int activeKeyStatus) { - this.activeKeyStatus = activeKeyStatus; - } //写入uuid private void writeUUID(XMLPrintWriter writer) { @@ -1814,7 +1834,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { writer.textNode("" + this.lastOpenFilePath); writer.end(); - writer.startTAG("Language").textNode(String.valueOf(this.language)).end() + writer.startTAG("Language").textNode(CommonUtils.localeToString(language)).end() .startTAG("JettyServerPort").textNode(String.valueOf(this.jettyServerPort)).end(); } @@ -1867,20 +1887,4 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { .end(); } - - public AlphaFineConfigManager getAlphaFineConfigManager() { - return alphaFineConfigManager; - } - - public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) { - this.alphaFineConfigManager = alphaFineConfigManager; - } - - public boolean isImageCompress() { - return imageCompress; - } - - public void setImageCompress(boolean imageCompress) { - this.imageCompress = imageCompress; - } } \ No newline at end of file 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 17d45f0292..f28ee3b722 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 @@ -4,8 +4,8 @@ import com.fr.base.BaseUtils; import com.fr.base.FRContext; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; - import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; @@ -33,7 +33,7 @@ public class VideoAction extends UpdateAction public void actionPerformed(ActionEvent arg0) { String url; - if (FRContext.getLocale().equals(Locale.US)) { + if (GeneralContext.getLocale().equals(Locale.US)) { url = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en"); } else { url = CloudCenter.getInstance().acquireUrlByKind("bbs.video"); diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index de57a4018d..37405bb55a 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -12,6 +12,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIColorButton; import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icombobox.UIComboBox; +import com.fr.design.gui.icombobox.UIDictionaryComboBox; import com.fr.design.gui.ilable.ActionLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ispinner.UISpinner; @@ -23,7 +24,6 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; import com.fr.general.FRFont; - import com.fr.general.log.Log4jConfig; import com.fr.locale.InterProviderFactory; import com.fr.third.apache.log4j.Level; @@ -32,14 +32,11 @@ import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; -import java.util.ArrayList; import java.util.Locale; import java.util.Map; @@ -87,9 +84,7 @@ public class PreferencePane extends BasicPane { private static final String DISPLAY_MINUS = "-"; private static final Level[] LOG = {Level.FATAL, Level.ERROR, Level.WARN, Level.INFO, Level.DEBUG}; - private static java.util.List LANGUAGE = new ArrayList<>(); - private static int designerEnvLanguageIndex; // 打开设置对话框时,设计器使用的语言 private boolean languageChanged; // 是否修改了设计器语言设置 //设置是否支持undo private UICheckBox supportUndoCheckBox; @@ -114,7 +109,8 @@ public class PreferencePane extends BasicPane { private UITextField logExportDirectoryField; - private UIComboBox logLevelComboBox, languageComboBox, pageLengthComboBox, reportLengthComboBox; + private UIComboBox logLevelComboBox, pageLengthComboBox, reportLengthComboBox; + private UIDictionaryComboBox languageComboBox; private IntegerEditor portEditor; private UITextField jdkHomeTextField; private UICheckBox oracleSpace; @@ -123,18 +119,8 @@ public class PreferencePane extends BasicPane { public PreferencePane() { this.initComponents(); - this.initLanguageItems(); } - // 语言选项 - private void initLanguageItems() { - LANGUAGE.clear(); - Map map = InterProviderFactory.getProvider().getSupportLocaleMap(); - LANGUAGE.add(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Language_Default")); - for (Locale locale : map.keySet()) { - LANGUAGE.add(getLocaledLanguage(map.get(locale), locale)); - } - } protected void initComponents() { JPanel contentPane = this; @@ -182,13 +168,6 @@ public class PreferencePane extends BasicPane { advancePane.add(spaceUpPane); } - private static String getLocaledLanguage(String key, Locale locale) { - StringBuilder sb = new StringBuilder(); - sb.append(com.fr.design.i18n.Toolkit.i18nText(key)).append("("); - sb.append(com.fr.design.i18n.Toolkit.i18nText(key)).append(")"); - return sb.toString(); - } - private void createFunctionPane(JPanel generalPane) { JPanel functionPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference-Function")); generalPane.add(functionPane); @@ -379,8 +358,9 @@ public class PreferencePane extends BasicPane { JPanel LanguagePane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Choose_Language")); generalPane.add(languageAndDashBoard_pane); languageAndDashBoard_pane.add(LanguagePane); - languageComboBox = new UIComboBox(LANGUAGE.toArray()); - languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文 + + languageComboBox = createLanguageComboBox(); + ActionLabel languageLabel = new ActionLabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Designer_Language")); languageLabel.addActionListener(new ActionListener() { @Override @@ -402,16 +382,26 @@ public class PreferencePane extends BasicPane { Component[][] components = { {languageLabel, languageComboBox, noticeLabel}, }; - languageComboBox.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent e) { - //Inter.fr = ResourceBundle.getBundle("com/fr/general/locale/fr", Locale.US); - } - }); JPanel choosePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); LanguagePane.add(choosePane); } + private UIDictionaryComboBox createLanguageComboBox() { + Map map = InterProviderFactory.getProvider().getSupportLocaleMap(); + int size = map.size(); + Locale[] keys = new Locale[size]; + String[] values = new String[size]; + int i = 0; + for (Map.Entry entry : map.entrySet()) { + keys[i] = entry.getKey(); + values[i] = com.fr.design.i18n.Toolkit.i18nText(entry.getValue()); + i++; + } + UIDictionaryComboBox languageComboBox = new UIDictionaryComboBox<>(keys, values); + languageComboBox.setFont(FRFont.getInstance("Dialog", Font.PLAIN, 12));//为了在中文系统中显示韩文 + return languageComboBox; + } + private String getDisplayShortCut(String shotrCut) { return shotrCut.replace(TYPE, DISPLAY_TYPE).replace(BACK_SLASH, DISPLAY_BACK_SLASH).replace(SLASH, DISPLAY_SLASH) .replace(CONTROL, DISPLAY_CONTROL).replace(OPEN_BRACKET, DISPLAY_OPEN_BRACKET).replace(CLOSE_BRACKET, DISPLAY_CLOSE_BRACKET) @@ -506,7 +496,7 @@ public class PreferencePane extends BasicPane { JPanel memoryPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_CachingTemplate")); UILabel memoryLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_MaxCachingTemplate")); UILabel memoryTipLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Preference_CachingTemplateTip")); - memoryTipLabel.setBorder(BorderFactory.createEmptyBorder( 0, CACHING_GAP, 0, 0)); + memoryTipLabel.setBorder(BorderFactory.createEmptyBorder(0, CACHING_GAP, 0, 0)); cachingTemplateSpinner = new UISpinner(0, CACHING_MAX, 1, CACHING_DEFAULT); JPanel memorySpace = new JPanel(FRGUIPaneFactory.createLeftZeroLayout()); memorySpace.add(memoryLabel); @@ -564,8 +554,8 @@ public class PreferencePane extends BasicPane { this.logLevelComboBox.setSelectedItem(Log4jConfig.getInstance().getRootLevel()); - this.languageComboBox.setSelectedItem(LANGUAGE.get(designerEnvManager.getLanguage())); - designerEnvLanguageIndex = designerEnvManager.getLanguage(); + this.languageComboBox.setSelectedItem(designerEnvManager.getLanguage()); + this.pageLengthComboBox.setSelectedIndex(designerEnvManager.getPageLengthUnit()); this.reportLengthComboBox.setSelectedIndex(designerEnvManager.getReportLengthUnit()); @@ -625,7 +615,7 @@ public class PreferencePane extends BasicPane { designerEnvManager.setPaginationLineColor(paginationLineColorTBButton.getColor()); - designerEnvManager.setLanguage(getLanguageInt()); + designerEnvManager.setLanguage(languageComboBox.getSelectedItem()); designerEnvManager.setPageLengthUnit((short) pageLengthComboBox.getSelectedIndex()); designerEnvManager.setReportLengthUnit((short) reportLengthComboBox.getSelectedIndex()); @@ -637,7 +627,6 @@ public class PreferencePane extends BasicPane { designerEnvManager.setOracleSystemSpace(this.oracleSpace.isSelected()); designerEnvManager.setCachingTemplateLimit((int) this.cachingTemplateSpinner.getValue()); designerEnvManager.setJoinProductImprove(this.joinProductImprove.isSelected()); -// designerEnvManager.setAutoBackUp(this.autoBackUp.isSelected()); designerEnvManager.setUndoLimit(maxUndoLimit.getSelectedIndex() * SELECTED_INDEX_5); if (maxUndoLimit.getSelectedIndex() == SELECTED_INDEX_5) { @@ -648,21 +637,6 @@ public class PreferencePane extends BasicPane { } - /* - * 得到所选语言的int值 - */ - private int getLanguageInt() { - int l = 0; - String lang = (String) this.languageComboBox.getSelectedItem(); - for (int i = 0; i < LANGUAGE.size(); i++) { - if (ComparatorUtils.equals(lang, LANGUAGE.get(i))) { - l = i; - break; - } - } - return l; - } - // 如果语言设置改变了,则显示重启对话框 public void showRestartDialog() { @@ -689,11 +663,7 @@ public class PreferencePane extends BasicPane { return showWindow(window, new DialogActionAdapter() { @Override public void doOk() { - if (languageComboBox.getSelectedIndex() != designerEnvLanguageIndex) { - languageChanged = true; - } else { - languageChanged = false; - } + languageChanged = !ComparatorUtils.equals(languageComboBox.getSelectedItem(), DesignerEnvManager.getEnvManager(false).getLanguage()); } }); } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 9b400f0522..564b6e6698 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -14,16 +14,15 @@ import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.utils.DesignUtils; +import com.fr.event.EventDispatcher; import com.fr.general.GeneralContext; - import com.fr.stable.EnvChangedListener; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; import com.fr.workspace.connect.AuthException; -import javax.swing.JOptionPane; -import javax.swing.UIManager; +import javax.swing.*; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.Iterator; diff --git a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java index 1d98477c2b..46aa254500 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/AboutPane.java @@ -10,8 +10,8 @@ import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; import com.fr.general.GeneralUtils; - import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.bridge.StableFactory; @@ -72,18 +72,18 @@ public class AboutPane extends JPanel { addPhoneAndQQPane(contentPane); // 官网 - JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + FRContext.getLocale(), ProductConstants.WEBSITE_URL)); + JPanel urlActionPane = getURLActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Official_Website"), CloudCenter.getInstance().acquireUrlByKind("website." + GeneralContext.getLocale(), ProductConstants.WEBSITE_URL)); // 支持邮箱 String defaultEmail = CloudCenter.getInstance().acquireUrlByKind("support.email", ProductConstants.SUPPORT_EMAIL); - JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + FRContext.getLocale(), defaultEmail)); + JPanel emailPane = getEmailActionPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Support_Email"), CloudCenter.getInstance().acquireUrlByKind("support.email." + GeneralContext.getLocale(), defaultEmail)); contentPane.add(urlActionPane); contentPane.add(emailPane); - if (FRContext.getLocale().equals(Locale.CHINA) || FRContext.getLocale().equals(Locale.TAIWAN)){ + if (GeneralContext.getLocale().equals(Locale.CHINA) || GeneralContext.getLocale().equals(Locale.TAIWAN)) { contentPane.add(getRemarkPane()); - } + } if (shouldShowThanks()) { addThankPane(contentPane); @@ -93,13 +93,13 @@ public class AboutPane extends JPanel { private void addPhoneAndQQPane(JPanel contentPane) { BoxCenterAligmentPane boxCenterAlignmentPane; // 英文版不显示服务电话和QQ - if (FRContext.getLocale().equals(Locale.US)) { + if (GeneralContext.getLocale().equals(Locale.US)) { return; } boxCenterAlignmentPane = new BoxCenterAligmentPane(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Service_Phone") + CloudCenter.getInstance().acquireUrlByKind("service.phone." + FRContext.getLocale(), COMPANY_TELEPHONE)); contentPane.add(boxCenterAlignmentPane); // 繁体版不显示QQ - if (FRContext.getLocale().equals(Locale.TAIWAN)) { + if (GeneralContext.getLocale().equals(Locale.TAIWAN)) { return; } boxCenterAlignmentPane = new BoxCenterAligmentPane("QQ: " + CloudCenter.getInstance().acquireUrlByKind("help.qq")); @@ -110,17 +110,17 @@ public class AboutPane extends JPanel { private boolean shouldShowThanks() { Locale[] hideLocales = {Locale.US, Locale.KOREA, Locale.JAPAN}; for (Locale loc : hideLocales) { - if (FRContext.getLocale().equals(loc)) { + if (GeneralContext.getLocale().equals(loc)) { return false; } } return true; } - private JPanel getRemarkPane(){ - String remark = com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_About_Remark_Info",PRESIDENT_PHONE); + private JPanel getRemarkPane() { + String remark = com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_About_Remark_Info", PRESIDENT_PHONE); UILabel label = new UILabel(); - label.setSize(new Dimension(580,30)); + label.setSize(new Dimension(580, 30)); //用THML标签进行拼接,以实现自动换行 StringBuilder builder = new StringBuilder(""); @@ -139,12 +139,12 @@ public class AboutPane extends JPanel { break; } } - builder.append(chars, start, len-1).append("
"); + builder.append(chars, start, len - 1).append("
"); start = start + len - 1; len = 0; } //拼接剩余部分 - builder.append(chars, start, remark.length()-start); + builder.append(chars, start, remark.length() - start); builder.append(""); JPanel jPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); @@ -184,7 +184,7 @@ public class AboutPane extends JPanel { StringUtils.BLANK, ProductConstants.RELEASE_VERSION, BUILD_PREFIX); } - private JPanel getEmailActionPane(final String desc, final String mailTo){ + private JPanel getEmailActionPane(final String desc, final String mailTo) { ActionLabel emailLabel = new ActionLabel(mailTo); emailLabel.addActionListener(new ActionListener() { @@ -204,7 +204,7 @@ public class AboutPane extends JPanel { return panel; } - private JPanel getURLActionPane(final String desc, final String url){ + private JPanel getURLActionPane(final String desc, final String url) { ActionLabel actionLabel = new ActionLabel(url); actionLabel.addActionListener(new ActionListener() { @Override diff --git a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java index 4e3ea83202..c0e255af7b 100644 --- a/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java @@ -6,6 +6,7 @@ import com.fr.base.Utils; import com.fr.design.actions.UpdateAction; import com.fr.design.menu.MenuKeySet; import com.fr.general.CloudCenter; +import com.fr.general.GeneralContext; import com.fr.general.http.HttpToolbox; import com.fr.stable.CommonUtils; import com.fr.stable.ProductConstants; @@ -78,7 +79,7 @@ public class TutorialAction extends UpdateAction { // 生成帮助文档 sitecenter key, help.zh_CN.10 protected String createDocKey() { - String locale = FRContext.getLocale().toString(); + String locale = GeneralContext.getLocale().toString(); return CommonUtils.join(new String[]{ "help", locale, ProductConstants.MAIN_VERSION }, "."); } diff --git a/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java b/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java index d112f7fe01..24f1111f3b 100644 --- a/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java +++ b/designer-base/src/main/java/com/fr/design/editor/editor/DateEditor.java @@ -6,9 +6,9 @@ package com.fr.design.editor.editor; import com.fr.base.FRContext; import com.fr.design.gui.date.UIDatePicker; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.GeneralContext; import javax.swing.*; - import java.awt.*; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; @@ -60,9 +60,9 @@ public class DateEditor extends Editor { this.setLayout(FRGUIPaneFactory.createBorderLayout()); uiDatePicker = new UIDatePicker(); if (format) { - int dateStyle = (FRContext.getLocale() == Locale.ENGLISH - || FRContext.getLocale() == Locale.US - || FRContext.getLocale() == Locale.UK) ? uiDatePicker.STYLE_EN_DATE : uiDatePicker.STYLE_CN_DATE; + int dateStyle = (GeneralContext.getLocale() == Locale.ENGLISH + || GeneralContext.getLocale() == Locale.US + || GeneralContext.getLocale() == Locale.UK) ? uiDatePicker.STYLE_EN_DATE : uiDatePicker.STYLE_CN_DATE; uiDatePicker.setStyle(dateStyle); uiDatePicker.setEditable(false); } diff --git a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java index 0d5622d6e9..72ff977766 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java +++ b/designer-base/src/main/java/com/fr/design/formula/FormulaPane.java @@ -20,6 +20,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.log.FineLoggerFactory; import com.fr.parser.FRLexer; import com.fr.parser.FRParser; import com.fr.stable.EncodeConstants; @@ -774,7 +775,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula { desBuf = getText((TextUserObject) selectedValue, path); } } catch (IOException exp) { - FRContext.getLogger().error(exp.getMessage(), exp); + FineLoggerFactory.getLogger().error(exp.getMessage(), exp); } descriptionTextArea.setText(desBuf.toString()); descriptionTextArea.moveCaretPosition(0); diff --git a/designer-base/src/main/java/com/fr/design/formula/FunctionNAD.java b/designer-base/src/main/java/com/fr/design/formula/FunctionNAD.java index fe52fb1dc6..411d0c8a6f 100644 --- a/designer-base/src/main/java/com/fr/design/formula/FunctionNAD.java +++ b/designer-base/src/main/java/com/fr/design/formula/FunctionNAD.java @@ -1,6 +1,6 @@ package com.fr.design.formula; -import com.fr.base.FRContext; +import com.fr.general.GeneralContext; import com.fr.script.CalculatorEmbeddedFunction; import com.fr.stable.StringUtils; import com.fr.stable.script.Function; @@ -10,29 +10,29 @@ import java.util.Locale; public class FunctionNAD extends AbstractNameAndDescription { - private Function fn; - - FunctionNAD(Function fn) { - this.fn = fn; - } - - public String getName() { - return fn == null ? StringUtils.EMPTY : fn.getClass().getSimpleName(); - } - - public String getDesc() { - if (fn == null) { - return StringUtils.EMPTY; - } - Locale locale = FRContext.getLocale(); - String describtion = fn.getDescription(locale); - if (describtion.startsWith(CalculatorEmbeddedFunction.LOCALE_PREFIX)) { - // 老的自定义函数兼容, 没有重写getDescription - return Locale.CHINA.equals(locale) ? fn.getCN() : fn.getEN(); - } - - return describtion; - } + private Function fn; + + FunctionNAD(Function fn) { + this.fn = fn; + } + + public String getName() { + return fn == null ? StringUtils.EMPTY : fn.getClass().getSimpleName(); + } + + public String getDesc() { + if (fn == null) { + return StringUtils.EMPTY; + } + Locale locale = GeneralContext.getLocale(); + String describtion = fn.getDescription(locale); + if (describtion.startsWith(CalculatorEmbeddedFunction.LOCALE_PREFIX)) { + // 老的自定义函数兼容, 没有重写getDescription + return Locale.CHINA.equals(locale) ? fn.getCN() : fn.getEN(); + } + + return describtion; + } @Override public String searchResult(String keyWord, boolean findDescription) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java index b569e054e1..69192af7f4 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java @@ -13,6 +13,7 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.DesignUtils; import com.fr.env.EnvListPane; +import com.fr.event.EventDispatcher; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; @@ -20,6 +21,7 @@ import com.fr.stable.EnvChangedListener; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; +import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.connect.AuthException; import javax.swing.*; 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 fcf8b7ddc1..ea6d694c70 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 @@ -50,7 +50,6 @@ import com.fr.design.remote.action.RemoteDesignAuthorityManagerAction; import com.fr.design.utils.ThemeUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; - import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.manage.PluginFilter; @@ -224,7 +223,7 @@ public abstract class ToolBarMenuDock { // 添加帮助菜单 menuList.add(createHelpMenuDef()); - if (FRContext.getLocale() == Locale.CHINA || FRContext.getLocale() == Locale.TAIWAN) { + if (GeneralContext.getLocale() == Locale.CHINA || GeneralContext.getLocale() == Locale.TAIWAN) { // 添加社区菜单 addCommunityMenuDef(menuList); } @@ -272,7 +271,7 @@ public abstract class ToolBarMenuDock { } public void addCommunityMenuDef(java.util.List menuList) { - Locale locale = FRContext.getLocale(); + Locale locale = GeneralContext.getLocale(); Locale[] locales = supportCommunityLocales(); for (int i = 0; i < locales.length; i++) { if (locale.equals(locales[i])) { @@ -451,7 +450,7 @@ public abstract class ToolBarMenuDock { java.util.List shortCuts = new ArrayList(); shortCuts.add(new WebDemoAction()); // 英文,把 video 和帮助文档放到 Help 下面 - if (FRContext.getLocale().equals(Locale.US)) { + if (GeneralContext.getLocale().equals(Locale.US)) { shortCuts.add(new VideoAction()); shortCuts.add(new TutorialAction()); } diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index b9f720e266..497dd07e03 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -226,7 +226,7 @@ public class DesignUtils { } //先初始化的设计器locale, 后初始化lookandfeel.如果顺序改了, 这边也要调整. - Locale designerLocale = FRContext.getLocale(); + Locale designerLocale = GeneralContext.getLocale(); String file = com.fr.design.i18n.Toolkit.i18nText("FR-Designer_File"); char displayChar = file.charAt(0); if (!guiFRFont.canDisplay(displayChar)) { diff --git a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java index 65a3e78df8..b7d123d66e 100644 --- a/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java +++ b/designer-base/src/test/java/com/fr/design/DesignerEnvManagerTest.java @@ -1,33 +1,20 @@ package com.fr.design; -import com.fr.locale.InterProviderFactory; import junit.framework.TestCase; -import java.util.HashSet; import java.util.Locale; public class DesignerEnvManagerTest extends TestCase{ public void testGetLocale() { DesignerEnvManager envManager = new DesignerEnvManager(); - assertEquals("默认值", envManager.getLocale(), Locale.CHINA); + assertEquals("默认值", envManager.getLanguage(), Locale.SIMPLIFIED_CHINESE); - HashSet result = new HashSet<>(); - Locale[] locales = envManager.supportLocale(); - int len = locales.length; - assertEquals(len, InterProviderFactory.getProvider().getSupportLocaleMap().size()); - for (int i = 0; i < len; i++) { - envManager.setLanguage(i + 1); - Locale locale = envManager.getLocale(); - result.add(locale); - } - assertEquals("每个int都有对应的locale", result.size(), len); + envManager.setLanguage(Locale.US); + assertEquals("上边界", envManager.getLanguage(), Locale.US); - envManager.setLanguage(998); - assertEquals("上边界", envManager.getLocale(), Locale.CHINA); - - envManager.setLanguage(-998); - assertEquals("下边界", envManager.getLocale(), Locale.CHINA); + envManager.setLanguage(Locale.SIMPLIFIED_CHINESE); + assertEquals("下边界", envManager.getLanguage(), Locale.SIMPLIFIED_CHINESE); } } diff --git a/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java b/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java index e538a637e3..7e4dad651a 100644 --- a/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java +++ b/designer-base/src/test/java/com/fr/design/actions/help/TutorialActionTest.java @@ -13,20 +13,17 @@ public class TutorialActionTest extends TestCase{ TutorialAction action = new TutorialAction(); GeneralContext.setLocale(Locale.US); String enKey = action.createDocKey(); - assertTrue(enKey.indexOf(Locale.US.toString()) != -1); - assertTrue(enKey.indexOf(ProductConstants.MAIN_VERSION) != -1); + assertTrue(enKey.contains(Locale.US.toString())); + assertTrue(enKey.contains(ProductConstants.MAIN_VERSION)); GeneralContext.setLocale(Locale.CHINA); String zhKey = action.createDocKey(); - assertTrue(zhKey.indexOf(Locale.CHINA.toString()) != -1); + assertTrue(zhKey.contains(Locale.CHINA.toString())); Locale pt = new Locale("pt", "PT"); GeneralContext.setLocale(pt); String ptKey = action.createDocKey(); - assertTrue(ptKey.indexOf(pt.toString()) != -1); - - GeneralContext.setLanguage(998); - assertTrue(action.createDocKey().indexOf(Locale.CHINA.toString()) != -1); + assertTrue(ptKey.contains(pt.toString())); } public void testServerOnline() { 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 5ffefb024e..c319af3413 100644 --- a/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java +++ b/designer-realize/src/main/java/com/fr/start/CollectUserInformationDialog.java @@ -1,6 +1,5 @@ package com.fr.start; -import com.fr.base.FRContext; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ibutton.UIButton; @@ -14,18 +13,12 @@ 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.stable.OperatingSystem; -import javax.swing.BorderFactory; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.WindowConstants; +import javax.swing.*; import javax.swing.border.TitledBorder; -import java.awt.BorderLayout; -import java.awt.Desktop; -import java.awt.Dimension; -import java.awt.Frame; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; @@ -147,7 +140,7 @@ public class CollectUserInformationDialog extends UIDialog { private void getKeyAction() { - Locale locale = FRContext.getLocale(); + Locale locale = GeneralContext.getLocale(); String url = EN_LOGIN_HTML; if (ComparatorUtils.equals(locale, Locale.TAIWAN)) { url = TW_LOGIN_HTML; 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 18c7085a7c..ebdad4c287 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -1,11 +1,10 @@ package com.fr.start; -import com.fr.base.FRContext; 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.module.ModuleEvent; import com.fr.stable.StringUtils; @@ -135,7 +134,7 @@ public class SplashContext { private boolean shouldShowThanks() { Locale[] hideLocales = {Locale.CHINA, Locale.TAIWAN}; for (Locale loc : hideLocales) { - if (FRContext.getLocale().equals(loc)) { + if (GeneralContext.getLocale().equals(loc)) { return true; } } diff --git a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java index 7797479900..1f7db56227 100644 --- a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java @@ -64,7 +64,7 @@ public class PreStartActivator extends Activator { private void initLanguage() { //这两句的位置不能随便调换,因为会影响语言切换的问题 - GeneralContext.setLocale(DesignerEnvManager.getEnvManager(false).getLocale()); + GeneralContext.setLocale(DesignerEnvManager.getEnvManager(false).getLanguage()); } @Override From c80dcdf0e7946ba7c4fd9c1bd46639988f1b2e99 Mon Sep 17 00:00:00 2001 From: ju Date: Tue, 31 Jul 2018 15:33:08 +0800 Subject: [PATCH 5/5] =?UTF-8?q?REPORT-10202=20=E6=B2=A1=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E7=9B=91=E5=90=AC=EF=BC=8C=E5=88=A0=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/actions/file/SwitchExistEnv.java | 15 --------------- .../design/file/HistoryTemplateListPane.java | 2 -- .../com/fr/design/mainframe/TemplatePane.java | 18 ++++++++++++++---- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java index 9b400f0522..d32a1aa678 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java @@ -9,14 +9,10 @@ import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.mainframe.DesignerContext; -import com.fr.design.mainframe.JTemplate; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.utils.DesignUtils; -import com.fr.general.GeneralContext; - -import com.fr.stable.EnvChangedListener; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; @@ -36,17 +32,6 @@ public class SwitchExistEnv extends MenuDef { this.setName(getMenuKeySet().getMenuName()); this.setHasScrollSubMenu(true); initMenuDef(); - JTemplate t = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); - if (t != null) { - GeneralContext.addEnvWillChangedListener( - t.getPath(), - new EnvChangedListener() { - public void envChanged() { - SwitchExistEnv.this.clearShortCuts(); - initMenuDef(); - } - }); - } } private void initMenuDef() { diff --git a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java index 12dad2ea85..6d828ccafd 100644 --- a/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java +++ b/designer-base/src/main/java/com/fr/design/file/HistoryTemplateListPane.java @@ -114,7 +114,6 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C public void closeSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); - GeneralContext.removeEnvWillChangedListener(selected.getPath()); if (contains(selected) == -1) { return; } @@ -139,7 +138,6 @@ public class HistoryTemplateListPane extends JPanel implements FileOperations, C public void closeVirtualSelectedReport(JTemplate selected) { DesignModuleFactory.clearChartPropertyPane(); DesignTableDataManager.closeTemplate(selected); - GeneralContext.removeEnvWillChangedListener(selected.getPath()); if (contains(selected) == -1) { return; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java index b569e054e1..a7a466bdb5 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/TemplatePane.java @@ -15,15 +15,26 @@ import com.fr.design.utils.DesignUtils; import com.fr.env.EnvListPane; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; - import com.fr.stable.EnvChangedListener; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; import com.fr.workspace.Workspace; import com.fr.workspace.connect.AuthException; -import javax.swing.*; -import java.awt.*; +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; @@ -132,7 +143,6 @@ public class TemplatePane extends JPanel implements MouseListener { final String selectedName = envListPane.updateEnvManager(); DesignerEnvManager envManager = DesignerEnvManager.getEnvManager(); DesignerWorkspaceInfo selectedEnv = envManager.getWorkspaceInfo(selectedName); - GeneralContext.fireEnvWillChangeListener(); try { Workspace workspace = DesignerWorkspaceGenerator.generate(selectedEnv); if (workspace == null) {