diff --git a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java index 31aac9aa1..602e1d110 100644 --- a/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java +++ b/designer-base/src/main/java/com/fr/design/os/impl/SupportOSImpl.java @@ -1,12 +1,17 @@ package com.fr.design.os.impl; import com.fr.base.FRContext; +import com.fr.general.CloudCenter; import com.fr.general.GeneralContext; +import com.fr.json.JSONObject; +import com.fr.stable.StringUtils; import com.fr.stable.os.Arch; import com.fr.stable.os.OperatingSystem; import com.fr.stable.os.support.SupportOS; import com.fr.workspace.WorkContext; +import java.util.Locale; + /** * @author pengda * @date 2019/10/9 @@ -44,10 +49,18 @@ public enum SupportOSImpl implements SupportOS { @Override public boolean support() { boolean isLocalEnv = WorkContext.getCurrent().isLocal(); - boolean isChineseEnv = GeneralContext.isChineseEnv(); boolean isLinux = OperatingSystem.isLinux(); // 远程设计和非中文环境以及Linux环境,都不生效 - return isLocalEnv && isChineseEnv && !isLinux; + return isLocalEnv && !isLinux && isPushByConf(); + } + + private boolean isPushByConf() { + String resp = CloudCenter.getInstance().acquireUrlByKind("update.push.conf"); + if (StringUtils.isEmpty(resp)) { + return Locale.CHINA.equals(GeneralContext.getLocale()); + } + JSONObject jo = new JSONObject(resp); + return jo.optBoolean(GeneralContext.getLocale().toString()); } }, /** diff --git a/designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java b/designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java new file mode 100644 index 000000000..188753797 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/os/impl/SupportOSImplTest.java @@ -0,0 +1,24 @@ +package com.fr.design.os.impl; + +import com.fr.general.GeneralContext; +import junit.framework.TestCase; +import org.junit.Assert; +import org.junit.Test; + +import java.util.Locale; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2020/1/16 + */ +public class SupportOSImplTest extends TestCase { + + @Test + public void testAutoPush() { + Assert.assertTrue(SupportOSImpl.AUTOPUSHUPDATE.support()); + GeneralContext.setLocale(Locale.TAIWAN); + Assert.assertFalse(SupportOSImpl.AUTOPUSHUPDATE.support()); + } + +} \ No newline at end of file diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java index f2dea0e7e..58b778065 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePaneAuthorityEditPane.java @@ -645,26 +645,10 @@ public class ElementCasePaneAuthorityEditPane extends AuthorityEditPane { return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_SMALL, LayoutConstants.VGAP_SMALL); } -// private JPanel populateWidgetCheckPane() { -// double f = TableLayout.FILL; -// double p = TableLayout.PREFERRED; -// Component[][] components = new Component[][]{ -// new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Cell"), SwingConstants.LEFT), cellElementVisibleCheckBoxes}, -// new Component[]{null, newValue}, -// new Component[]{null, valueEditor}, -// new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("FR-Designer_Widget"), SwingConstants.LEFT), widgetVisible}, -// new Component[]{null, widgetAvailable} -// }; -// double[] rowSize = {p, p, p, p, p}; -// double[] columnSize = {p, f}; -// int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; -// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); -// } - private JPanel populateWidgetCheckPane() { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; - UILabel cv = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Value") + " "); + UILabel cv = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Value") + " "); cv.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0)); Component[][] components = new Component[][]{ new Component[]{cellElementVisibleCheckBoxes, null}, @@ -705,27 +689,13 @@ public class ElementCasePaneAuthorityEditPane extends AuthorityEditPane { return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); } -// private JPanel populatCellCheckPane() { -// double f = TableLayout.FILL; -// double p = TableLayout.PREFERRED; -// Component[][] components = new Component[][]{ -// new Component[]{cellElementVisibleCheckBoxes}, -// new Component[]{newValue}, -// new Component[]{valueEditor} -// }; -// double[] rowSize = {p, p, p}; -// double[] columnSize = {f}; -// int[][] rowCount = {{1}, {1}, {1}}; -// return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM); -// } - private JPanel populatCellCheckPane() { double f = TableLayout.FILL; double p = TableLayout.PREFERRED; double[] rowSize = {p, p, p}; double[] columnSize = {p, f}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; - UILabel cv = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Value") + " "); + UILabel cv = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Cell_Value") + " "); cv.setBorder(BorderFactory.createEmptyBorder(0, LEFT_CHECKPANE, 0, 0)); Component[][] components = new Component[][]{ new Component[]{cellElementVisibleCheckBoxes,null},