From 9bc67ee4758c7ad9684fef1b1d88345c8bc38ffb Mon Sep 17 00:00:00 2001 From: kuangshuai Date: Mon, 31 May 2021 18:46:14 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-53022=20=E6=9C=AC=E5=9C=B0=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=BA=93=E5=88=B7=E6=96=B0=E5=90=8E=E7=9A=84=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/share/ui/local/GroupPane.java | 3 +++ .../design/mainframe/share/ui/local/LocalWidgetSelectPane.java | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java index bfa6343e06..05507a786f 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/GroupPane.java @@ -18,6 +18,7 @@ import com.fr.design.utils.gui.GUICoreUtils; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.group.DefaultShareGroupManager; import com.fr.form.share.Group; +import com.fr.form.share.record.ShareWidgetInfoManager; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; @@ -100,6 +101,8 @@ class GroupPane extends JPanel { searchByKeyword(keyWord); return; } + ShareWidgetInfoManager.getInstance().checkInstallCompInfo(elCaseBindInfoList); + sortType.sort(elCaseBindInfoList); reCreateShowPane(elCaseBindInfoList); expendGroup(needExpendGroup); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetSelectPane.java index 8c6a9a6c3a..44bdd0fa5d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/local/LocalWidgetSelectPane.java @@ -73,7 +73,6 @@ public class LocalWidgetSelectPane extends AbstractWidgetSelectPane { } else { showEmpty(); } - ShareWidgetInfoManager.getInstance().checkInstallCompInfo(providers); } public Group getGroup() { From f3477809dc2405201d85391d9f02281df9a50827 Mon Sep 17 00:00:00 2001 From: vito Date: Tue, 1 Jun 2021 10:59:06 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20designer?= =?UTF-8?q?=E6=89=93=E5=8C=85=E5=BC=95=E7=94=A8=E6=B7=B7=E6=B7=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/app/DesignerAppActivator.java | 2 + .../mainframe/app/DesignerAppUtils.java | 12 +- .../fr/design/mainframe/app/PluginRemote.java | 138 ++++++++++++++++++ 3 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/app/PluginRemote.java diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java index ec425847dc..e4038ab42e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java @@ -19,6 +19,7 @@ public class DesignerAppActivator extends Activator implements Prepare { for (App app : appList) { JTemplateFactory.register(app); } + PluginRemote.getInstance().start(); } @Override @@ -28,6 +29,7 @@ public class DesignerAppActivator extends Activator implements Prepare { for (App app : appList) { JTemplateFactory.remove(app); } + PluginRemote.getInstance().stop(); } @Override diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java index 2064bc0449..e0dfb3b6cb 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java @@ -6,11 +6,11 @@ import com.fr.design.extra.exe.callback.InstallOnlineCallback; import com.fr.design.extra.exe.callback.ModifyStatusCallback; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.app.PluginRemote.PluginStatus; import com.fr.design.ui.util.UIUtil; import com.fr.locale.InterProviderFactory; import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarkerAdapter; -import com.fr.plugin.engine.remote.PluginRemoteSync; import com.fr.plugin.manage.PluginManager; import com.fr.plugin.manage.control.PluginControllerHelper; import com.fr.plugin.manage.control.PluginTask; @@ -130,21 +130,21 @@ public class DesignerAppUtils { * @param pendingPlugins 待处理列表 */ public static void rearrange(Multimap pendingPlugins) { - Map pluginRemoteStatusByIdIndex = PluginRemoteSync.getInstance().getPluginRemoteStatusByIdIndex(); + Map pluginRemoteStatus = PluginRemote.getInstance().getPluginRemoteStatus(); Collection unknownPlugins = pendingPlugins.get(TemplateIOErrorContextHolder.UNKNOWN_PLUGIN); Collection notInstall = pendingPlugins.get(TemplateIOErrorContextHolder.NOT_INSTALLED_PLUGIN); Collection disable = pendingPlugins.get(TemplateIOErrorContextHolder.DISABLE_PLUGIN); - unknownPlugins.removeIf(adapter -> pluginRemoteStatusByIdIndex.containsKey(adapter.getPluginID())); + unknownPlugins.removeIf(adapter -> pluginRemoteStatus.containsKey(adapter.getPluginID())); // 本地未启用名单不准确添加到一起之后重新分配 notInstall.addAll(disable); disable.clear(); // 从所有未安装中过滤远程未启用的,添加到未启用列表 disable.addAll(notInstall.stream().filter(plugin -> - pluginRemoteStatusByIdIndex.containsKey(plugin.getPluginID()) - && !pluginRemoteStatusByIdIndex.get(plugin.getPluginID()).isRunning()) + pluginRemoteStatus.containsKey(plugin.getPluginID()) + && !pluginRemoteStatus.get(plugin.getPluginID()).isRunning()) .collect(Collectors.toList())); // 清理未安装中所有远程安装过的插件(包含启用和未启用) - notInstall.removeIf(adapter -> pluginRemoteStatusByIdIndex.containsKey(adapter.getPluginID())); + notInstall.removeIf(adapter -> pluginRemoteStatus.containsKey(adapter.getPluginID())); } /** diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/PluginRemote.java b/designer-realize/src/main/java/com/fr/design/mainframe/app/PluginRemote.java new file mode 100644 index 0000000000..4bd4bdccc3 --- /dev/null +++ b/designer-realize/src/main/java/com/fr/design/mainframe/app/PluginRemote.java @@ -0,0 +1,138 @@ +package com.fr.design.mainframe.app; + +import com.fr.base.FRContext; +import com.fr.json.JSONArray; +import com.fr.json.JSONException; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginMarker; +import com.fr.stable.StringUtils; +import com.fr.value.AtomicClearableLazyValue; +import com.fr.workspace.WorkContext; +import org.jetbrains.annotations.NotNull; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +/** + * 获取远程插件情况,定时刷新 + * + * @author vito + * @version 10.0 + * Created by vito on 2021/6/1 + */ +public class PluginRemote { + + private static final PluginRemote INSTANCE = new PluginRemote(); + private final AtomicClearableLazyValue> lazyValue = new AtomicClearableLazyValue>() { + @NotNull + @Override + protected Map compute() { + return getRemoteStatus(); + } + }; + + /** + * 时间间隔两分钟 + */ + private static final int INTERVAL = 2; + + private ScheduledExecutorService executor; + + public static PluginRemote getInstance() { + + return INSTANCE; + } + + /** + * 获取远程插件状态 + * @return 远程插件状态 + */ + public Map getPluginRemoteStatus() { + return lazyValue.getValue(); + } + + private Map getRemoteStatus() { + + JSONArray statusArray = FRContext.getCommonOperator().getPluginStatus(); + JSONObject status; + String id; + String version; + boolean running; + Map statusMap = new HashMap<>(); + for (int i = 0; i < statusArray.length(); i++) { + try { + status = statusArray.getJSONObject(i); + id = status.getString("id"); + version = status.getString("version"); + running = status.getBoolean("running"); + if(StringUtils.isBlank(id)){ + continue; + } + PluginStatus pluginStatus = PluginStatus.create(id, version, running); + if (pluginStatus != null) { + statusMap.put(id, pluginStatus); + } + } catch (JSONException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + return statusMap; + } + + + public void start() { + // 远程环境下开始同步插件情况 + if (!WorkContext.getCurrent().isLocal()) { + executor = Executors.newSingleThreadScheduledExecutor(); + executor.scheduleAtFixedRate(() -> { + lazyValue.drop(); + lazyValue.getValue(); + }, 0, INTERVAL, TimeUnit.MINUTES); + } + } + + public void stop() { + + if (executor != null) { + executor.shutdown(); + executor = null; + lazyValue.drop(); + } + } + + public static class PluginStatus { + + private final PluginMarker marker; + + private final boolean running; + + private PluginStatus(PluginMarker marker, boolean running) { + + this.marker = marker; + this.running = running; + } + + static PluginStatus create(String id, String version, boolean running) { + + PluginMarker marker = PluginMarker.create(id, version); + if (marker != null && marker.valid()) { + return new PluginStatus(marker, running); + } + return null; + } + + public PluginMarker getMarker() { + + return marker; + } + + public boolean isRunning() { + + return running; + } + } +} From f9c4b5fe4470e1c437fda20c6caee8a124fdc37b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Tue, 1 Jun 2021 11:22:42 +0800 Subject: [PATCH 3/5] =?UTF-8?q?REPORT-52933=20[=E9=98=BB=E6=AD=A2]?= =?UTF-8?q?=E4=BF=AE=E6=94=B9log=E5=AF=BC=E5=87=BA=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=90=8E=EF=BC=8Clog=E4=B8=80=E7=9B=B4?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 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 b8951ea8ba..e5a8e7cf4f 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -15,20 +15,18 @@ 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.fun.DesignerPortProvider; import com.fr.design.i18n.Toolkit; import com.fr.design.locale.impl.ProductImproveMark; import com.fr.design.mainframe.vcs.VcsConfigManager; import com.fr.design.notification.SnapChatConfig; import com.fr.design.port.DesignerPortContext; -import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.style.color.ColorSelectConfigManager; +import com.fr.design.update.push.DesignerPushUpdateConfigManager; import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignerPort; import com.fr.exit.DesignerExiter; import com.fr.file.FILEFactory; import com.fr.general.ComparatorUtils; -import com.fr.general.FRLogFormatter; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.general.SupportLocale; @@ -36,15 +34,14 @@ 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.log.LogHandler; import com.fr.stable.CommonUtils; import com.fr.stable.Constants; import com.fr.stable.CoreConstants; -import com.fr.stable.EnvChangedListener; import com.fr.stable.ListMap; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; -import com.fr.stable.bridge.StableFactory; import com.fr.stable.core.UUID; import com.fr.stable.project.ProjectConstants; import com.fr.stable.xml.XMLPrintWriter; @@ -52,6 +49,7 @@ import com.fr.stable.xml.XMLReadable; import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLWriter; import com.fr.stable.xml.XMLableReader; +import com.fr.third.apache.log4j.FileAppender; import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContextCallback; @@ -78,8 +76,6 @@ import java.util.ListIterator; import java.util.Locale; import java.util.Map; import java.util.Map.Entry; -import java.util.logging.FileHandler; -import java.util.logging.Handler; /** * The manager of Designer GUI. @@ -306,14 +302,23 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { calender.setTimeInMillis(System.currentTimeMillis()); String today = calender.get(Calendar.YEAR) + "-" + (calender.get(Calendar.MONTH) + 1) + "-" + calender.get(Calendar.DAY_OF_MONTH); - String fileName = StableUtils.pathJoin(logLocation, "fr_" + today + "_%g.log"); + final String fileName = StableUtils.pathJoin(logLocation, "fr_" + today + "_%g.log"); if (!new File(fileName).exists()) { StableUtils.makesureFileExist(new File(fileName)); } - Handler handler = new FileHandler(fileName, true); + LogHandler handler = new LogHandler() { + final FileAppender appender = new FileAppender( + new com.fr.third.apache.log4j.PatternLayout("%d{HH:mm:ss} %t %p [%c] %m%n"), + fileName + ); + + @Override + public FileAppender getHandler() { + return appender; + } + }; - handler.setFormatter(new FRLogFormatter()); - FineLoggerFactory.getLogger().addLogHandler(handler); + FineLoggerFactory.getLogger().addLogAppender(handler); } catch (SecurityException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } catch (IOException e) { From e17b41cb912045745bf7c84ab07f0f482d61e82d Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 1 Jun 2021 11:46:34 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-51683=20=E5=AF=B9=E8=B1=A1/classload?= =?UTF-8?q?er=E8=BF=87=E6=BB=A4=E7=BC=A9=E7=95=A5=E5=9B=BE=20=E5=89=AA?= =?UTF-8?q?=E6=9E=9D=E5=8A=A0=E9=80=9F=E6=9F=A5=E6=89=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/file/filter/ClassFilter.java | 3 +++ .../src/main/java/com/fr/design/mod/ModClassFilter.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java b/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java index c04d806345..6c998f4ef1 100644 --- a/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java +++ b/designer-base/src/main/java/com/fr/design/file/filter/ClassFilter.java @@ -5,6 +5,8 @@ import java.util.HashSet; import java.util.Set; /** + * classloader查找过滤器 + * * 过滤无需遍历的jdk class * * @author hades @@ -26,6 +28,7 @@ public class ClassFilter implements Filter { FILTER_SET.add("java.awt.image.BufferedImage"); FILTER_SET.add("sun.awt.AppContext"); FILTER_SET.add("com.fr.poly.creator.ECBlockCreator"); + FILTER_SET.add("com.fr.form.ui.ElementCaseImage"); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mod/ModClassFilter.java b/designer-base/src/main/java/com/fr/design/mod/ModClassFilter.java index 4bf02549a4..7caa88ac49 100644 --- a/designer-base/src/main/java/com/fr/design/mod/ModClassFilter.java +++ b/designer-base/src/main/java/com/fr/design/mod/ModClassFilter.java @@ -5,6 +5,8 @@ import java.util.HashSet; import java.util.Set; /** + * 联动修改的类过滤器 + * * @author hades * @version 10.0 * Created by hades on 2021/5/31 @@ -24,6 +26,7 @@ public class ModClassFilter implements Filter { FILTER_SET.add("sun.awt.AppContext"); FILTER_SET.add("com.fr.poly.creator.ECBlockCreator"); FILTER_SET.add("io.netty.channel.nio.SelectedSelectionKeySet"); + FILTER_SET.add("com.fr.form.ui.ElementCaseImage"); } @Override From 648f175fe07297ead80bff677866bc8070b6d42b Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 1 Jun 2021 15:35:42 +0800 Subject: [PATCH 5/5] =?UTF-8?q?REPORT-53036=20=E7=BB=84=E4=BB=B6=E5=A4=8D?= =?UTF-8?q?=E7=94=A8-=E5=90=88=E5=85=A5=E4=B8=BB=E7=89=88=E6=9C=AC-?= =?UTF-8?q?=E4=B8=8B=E6=BB=91=E5=87=BA=E7=8E=B0=E7=9A=84=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E6=8F=90=E7=A4=BA=EF=BC=8C=E8=93=9D=E5=AD=97?= =?UTF-8?q?=E9=A2=84=E6=9C=9F=E6=98=AF=E2=80=9C=E5=A4=8D=E7=94=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E2=80=9D=EF=BC=8C=E7=8E=B0=E5=9C=A8=E6=98=AF=E2=80=9C?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=A4=8D=E7=94=A8=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/ReuseTriggerPointManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/ReuseTriggerPointManager.java b/designer-form/src/main/java/com/fr/design/mainframe/ReuseTriggerPointManager.java index beb779be8c..e0b975fb0c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/ReuseTriggerPointManager.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/ReuseTriggerPointManager.java @@ -177,7 +177,7 @@ public class ReuseTriggerPointManager { private JPanel createReusePrompt(JForm jForm) { JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); jPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Component_Reuse_Try_Prompt")), BorderLayout.WEST); - UILabel reuseLabel = new UILabel(Toolkit.i18nText("Fine-Design_Component_Reuse")); + UILabel reuseLabel = new UILabel(Toolkit.i18nText("Fine-Design_Share_Component")); reuseLabel.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) {