From ec81dc46e957b9cd4cdf7528fa4f5ed2064b774d Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 30 Aug 2017 14:00:29 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-3975=20=E6=8F=92=E4=BB=B6=E5=95=86?= =?UTF-8?q?=E5=9F=8E=E9=85=8D=E5=90=88=E6=8F=92=E4=BB=B6=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/extra/PluginOperateUtils.java | 12 +++++++--- .../src/com/fr/design/extra/PluginUtils.java | 22 +++++++++++++++++++ .../exe/callback/InstallFromDiskCallback.java | 2 +- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java index a590a6712b..7fe4101d3f 100644 --- a/designer_base/src/com/fr/design/extra/PluginOperateUtils.java +++ b/designer_base/src/com/fr/design/extra/PluginOperateUtils.java @@ -140,7 +140,8 @@ public class PluginOperateUtils { String result = httpClient.getResponseText(); JSONObject jsonObject = new JSONObject(result); JSONArray jsonArray = jsonObject.getJSONArray("result"); - jsCallback.execute(jsonArray.toString()); + JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray); + jsCallback.execute(resultJSONArray.toString()); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); } @@ -171,7 +172,8 @@ public class PluginOperateUtils { String result = httpClient.getResponseText(); JSONObject resultJSONObject = new JSONObject(result); JSONArray resultArr = resultJSONObject.getJSONArray("result"); - jsCallback.execute(resultArr.toString()); + JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(resultArr); + jsCallback.execute(resultJSONArray.toString()); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); } @@ -190,7 +192,9 @@ public class PluginOperateUtils { try { HttpClient httpClient = new HttpClient(plistUrl.toString()); String result = httpClient.getResponseText(); - jsCallback.execute(result); + JSONArray jsonArray = new JSONArray(result); + JSONArray resultJSONArray = PluginUtils.filterPluginsFromVersion(jsonArray); + jsCallback.execute(resultJSONArray.toString()); } catch (Exception e) { FRLogger.getLogger().error(e.getMessage()); } @@ -300,4 +304,6 @@ public class PluginOperateUtils { return pluginInfo.toString(); } + + } diff --git a/designer_base/src/com/fr/design/extra/PluginUtils.java b/designer_base/src/com/fr/design/extra/PluginUtils.java index 186b466ddd..7ef3eaaad6 100644 --- a/designer_base/src/com/fr/design/extra/PluginUtils.java +++ b/designer_base/src/com/fr/design/extra/PluginUtils.java @@ -7,6 +7,8 @@ import com.fr.general.SiteCenter; import com.fr.general.http.HttpClient; import com.fr.json.JSONArray; import com.fr.json.JSONObject; +import com.fr.plugin.basic.version.Version; +import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginMarker; @@ -184,4 +186,24 @@ public class PluginUtils { } return null; } + + /** + * 在不同设计器版本下展示不同插件 + * @return 插件 + */ + public static JSONArray filterPluginsFromVersion(JSONArray oriJSONArray) throws Exception{ + JSONArray resultJSONArray = JSONArray.create(); + for(int i = 0; i < oriJSONArray.length(); i++){ + JSONObject jo = oriJSONArray.getJSONObject(i); + String envVersion = jo.optString("env-version"); + if(isCompatibleCurrentEnv(envVersion)){ + resultJSONArray.put(jo); + } + } + return resultJSONArray; + } + + private static boolean isCompatibleCurrentEnv(String envVersion){ + return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion()); + } } diff --git a/designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java b/designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java index 28c2c139dd..834f4370d0 100644 --- a/designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java +++ b/designer_base/src/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java @@ -77,7 +77,7 @@ public class InstallFromDiskCallback extends AbstractPluginTaskCallback { }else { jsCallback.execute("failed"); FRLogger.getLogger().info(Inter.getLocText("FR-Plugin_Install_Failed")); - JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Designer-Plugin_Warning"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, PluginUtils.getMessageByErrorCode(result.errorCode()), Inter.getLocText("FR-Plugin_Install_Failed"), JOptionPane.ERROR_MESSAGE); } } } From 6e314b7f61978df42be4688ef70572da7d018c69 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 30 Aug 2017 16:53:50 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-4271=20[9.0=E4=B8=80=E8=BD=AE?= =?UTF-8?q?=E5=9B=9E=E5=BD=92]=E6=97=A0=E6=B3=95=E6=8F=92=E5=85=A5?= =?UTF-8?q?=E5=AD=90=E6=8A=A5=E8=A1=A8=EF=BC=8C=E5=BC=B9=E5=87=BA=E7=9A=84?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86=E4=B8=AD=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E9=A2=84=E8=A7=88=E6=B2=A1=E6=9C=89=E5=93=8D?= =?UTF-8?q?=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/file/FILEChooserPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/file/FILEChooserPane.java b/designer_base/src/com/fr/file/FILEChooserPane.java index cdc0c2c0f9..02c92f646b 100644 --- a/designer_base/src/com/fr/file/FILEChooserPane.java +++ b/designer_base/src/com/fr/file/FILEChooserPane.java @@ -16,6 +16,7 @@ import com.fr.design.gui.itextfield.UIAutoCompletionField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.JTemplate; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.file.filetree.FileNode; @@ -475,7 +476,7 @@ public class FILEChooserPane extends BasicPane { this.suffix = suffix; - dialog = showWindow((Window) parent, false); + dialog = showWindow(parent instanceof DesignerFrame ? (Window) parent : SwingUtilities.getWindowAncestor(parent), false); JPanel contentPane = (JPanel) dialog.getContentPane(); contentPane.setLayout(FRGUIPaneFactory.createM_BorderLayout()); contentPane.add(this, BorderLayout.CENTER); From 75e626136264a1a6c64da027e2937cdde0bad0e6 Mon Sep 17 00:00:00 2001 From: plough Date: Wed, 30 Aug 2017 18:34:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-3163=20=E5=90=88=E4=BD=9C=E5=BC=80?= =?UTF-8?q?=E5=8F=919.0=E8=AE=BE=E8=AE=A1=E5=99=A8=3D>=E9=AA=8C=E6=94=B6?= =?UTF-8?q?=3D>=E5=88=87=E6=8D=A2sheet=E6=97=B6=E5=BA=94=E7=AB=8B=E5=8D=B3?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E5=8F=B3=E4=BE=A7=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer/src/com/fr/design/mainframe/SheetNameTabPane.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/designer/src/com/fr/design/mainframe/SheetNameTabPane.java b/designer/src/com/fr/design/mainframe/SheetNameTabPane.java index 173bd9cd4f..8e63aa815b 100644 --- a/designer/src/com/fr/design/mainframe/SheetNameTabPane.java +++ b/designer/src/com/fr/design/mainframe/SheetNameTabPane.java @@ -554,10 +554,12 @@ public class SheetNameTabPane extends JComponent implements MouseListener, Mouse for (int i = scrollIndex; i <= lastOneIndex; i++) { int textWidth = widthArray[i]; if (evtX >= textX && evtX < textX + textWidth) { - if (getSelectedIndex() != i) { + boolean needRefreshPropertiesPane = getSelectedIndex() != i; + setSelectedIndex(i); + if (needRefreshPropertiesPane) { HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); } - setSelectedIndex(i); + isBlank = false; reportComposite.setComposite(); if (isAuthorityEditing) {