From 09e566223342f9c6078e366eac5878cac23d48c7 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 3 Jul 2024 14:12:44 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=20REPORT-114392=20FR-FBP=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E9=80=82=E9=85=8D=20?= =?UTF-8?q?=E5=8E=BB=E9=99=A4Activator=E4=BD=93=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 1 + .../fr/common/detect/CommonPortDetector.java | 4 +- .../update/acquirer/AbstractAcquirer.java | 4 +- .../acquirer/AcquirerExecutorService.java | 4 +- .../design/data/DesignTableDataManager.java | 4 +- .../data/datapane/ESDStrategyConfigPane.java | 3 +- .../fr/design/dialog/NotificationDialog.java | 4 +- .../icombobox/TableSearchTreeComboBox.java | 4 +- .../design/gui/style/FormatePaneNumField.java | 4 +- .../com/fr/design/mainframe/AppGroup.java | 13 + .../mainframe/theme/AsyncThemeFetcher.java | 4 +- .../design/mainframe/toast/SimpleToast.java | 5 +- .../mainframe/toast/ToastMsgDialog.java | 4 +- ...ationConfigWebApplicationContextShell.java | 14 + .../fr/start/server/DesignEmbedHelper.java | 13 +- .../fr/start/server/DesignEmbedLauncher.java | 7 +- .../com/fr/start/server/FineEmbedServer.java | 1 - .../style/series/ColorPickerPaneNumFiled.java | 4 +- .../fr/design/module/ChartPreStyleAction.java | 6 +- .../share/ui/block/PreviewWidgetBlock.java | 6 +- .../share/ui/online/embed/EmbedPane.java | 4 +- .../embed/OnlineEmbedFilterSelectPane.java | 4 +- .../boot/env/DesignEnvChooseComponent.java | 17 +- .../fanruan/boot/env/DesignEnvComponent.java | 20 + .../boot/env/DesignFunctionComponent.java | 37 +- .../env/function/ChartDesignerComponent.java | 34 +- .../env/function/DesignAnalyzerComponent.java | 169 +++++ .../function/DesignChartBaseComponent.java | 47 ++ .../boot/env/function/DesignComponent.java | 585 ++++++++++++++++++ .../function/DesignDatasourceComponent.java | 45 ++ .../boot/env/function/DesignESDComponent.java | 30 + .../env/function/DesignFormBaseComponent.java | 46 ++ .../function/DesignReportBaseComponent.java | 35 ++ .../env/function/DesignUpdateComponent.java | 91 +++ .../DesignVcsFolderManagerComponent.java | 26 + .../function}/app/AbstractWorkBookApp.java | 2 +- .../boot/env/function}/app/CptApp.java | 3 +- .../boot/env/function}/app/CptxApp.java | 2 +- .../env/function/app/DesignAppComponent.java | 55 ++ .../env/function}/app/DesignerAppUtils.java | 5 +- .../boot/env/function}/app/FormApp.java | 9 +- .../boot/env/function}/app/PluginRemote.java | 2 +- .../boot/env/function}/app/XlsApp.java | 2 +- .../boot/env/function}/app/XlsxApp.java | 2 +- .../init/DesignSerializationComponent.java | 77 ++- .../boot/init/DesignerInitComponent.java | 233 ++++++- .../mainframe/app/DesignerAppActivator.java | 42 -- .../StartupMessageCollector.java | 66 +- .../java/com/fr/start/CarinaDesigner.java | 2 + 49 files changed, 1610 insertions(+), 191 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/mainframe/AppGroup.java create mode 100644 designer-base/src/main/java/com/fr/start/server/AnnotationConfigWebApplicationContextShell.java rename designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java => designer-realize/src/main/java/com/fanruan/boot/env/function/ChartDesignerComponent.java (72%) create mode 100644 designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/env/function/DesignESDComponent.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/env/function/DesignFormBaseComponent.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/env/function/DesignReportBaseComponent.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/env/function/DesignUpdateComponent.java create mode 100644 designer-realize/src/main/java/com/fanruan/boot/env/function/DesignVcsFolderManagerComponent.java rename designer-realize/src/main/java/com/{fr/design/mainframe => fanruan/boot/env/function}/app/AbstractWorkBookApp.java (98%) rename designer-realize/src/main/java/com/{fr/design/mainframe => fanruan/boot/env/function}/app/CptApp.java (98%) rename designer-realize/src/main/java/com/{fr/design/mainframe => fanruan/boot/env/function}/app/CptxApp.java (98%) create mode 100644 designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java rename designer-realize/src/main/java/com/{fr/design/mainframe => fanruan/boot/env/function}/app/DesignerAppUtils.java (98%) rename designer-realize/src/main/java/com/{fr/design/mainframe => fanruan/boot/env/function}/app/FormApp.java (93%) rename designer-realize/src/main/java/com/{fr/design/mainframe => fanruan/boot/env/function}/app/PluginRemote.java (98%) rename designer-realize/src/main/java/com/{fr/design/mainframe => fanruan/boot/env/function}/app/XlsApp.java (97%) rename designer-realize/src/main/java/com/{fr/design/mainframe => fanruan/boot/env/function}/app/XlsxApp.java (97%) delete mode 100644 designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java diff --git a/build.gradle b/build.gradle index bba1d9cead..0a0d1b2d04 100644 --- a/build.gradle +++ b/build.gradle @@ -78,6 +78,7 @@ allprojects { implementation 'com.fr.license:fine-license-webui:' + apiVersion // 认证前端依赖 implementation 'com.fr.auth:fine-auth-webui:' + apiVersion + implementation 'com.fr.portal:fine-portal-api:' + apiVersion implementation 'com.fr.essential:fine-essential:' + cbbVersion implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion implementation 'com.fr.plugin:fine-plugin-api:' + apiVersion diff --git a/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java b/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java index 310e75dce0..a8ea159121 100644 --- a/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java +++ b/designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java @@ -1,9 +1,9 @@ package com.fr.common.detect; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.log.FineLoggerFactory; -import com.fr.module.ModuleContext; import com.fr.web.WebSocketConfig; import java.net.Socket; @@ -17,7 +17,7 @@ import java.util.concurrent.ExecutorService; public class CommonPortDetector { private static final CommonPortDetector INSTANCE = new CommonPortDetector(); - private ExecutorService service = ModuleContext.getExecutor().newSingleThreadExecutor(new NamedThreadFactory("CommonPortDetector")); + private ExecutorService service = ComponentUtils.getExecutor().newSingleThreadExecutor(new NamedThreadFactory("CommonPortDetector")); public static CommonPortDetector getInstance() { return INSTANCE; diff --git a/designer-base/src/main/java/com/fr/decision/update/acquirer/AbstractAcquirer.java b/designer-base/src/main/java/com/fr/decision/update/acquirer/AbstractAcquirer.java index be92349ce1..7c01ee51ce 100644 --- a/designer-base/src/main/java/com/fr/decision/update/acquirer/AbstractAcquirer.java +++ b/designer-base/src/main/java/com/fr/decision/update/acquirer/AbstractAcquirer.java @@ -1,11 +1,11 @@ package com.fr.decision.update.acquirer; +import com.fanruan.ComponentUtils; import com.fanruan.product.ProductConstants; import com.fr.base.j2v8.J2V8Utils; import com.fr.decision.update.command.SyncCommandHandler; import com.fr.decision.update.data.UpdateConstants; import com.fr.general.GeneralUtils; -import com.fr.module.ModuleContext; import com.fr.stable.ProjectLibrary; import com.fr.stable.StableUtils; import com.fr.stable.os.AbstractOperatingSystem; @@ -60,7 +60,7 @@ public abstract class AbstractAcquirer implements Acquirer { } private static String type() { - if (ModuleContext.isDesignerStartup()) { + if (ComponentUtils.isDesignerStart()) { return UpdateConstants.DESIGNER; } else { return UpdateConstants.DECISION; diff --git a/designer-base/src/main/java/com/fr/decision/update/acquirer/AcquirerExecutorService.java b/designer-base/src/main/java/com/fr/decision/update/acquirer/AcquirerExecutorService.java index 0d3afd3316..3bb0565648 100644 --- a/designer-base/src/main/java/com/fr/decision/update/acquirer/AcquirerExecutorService.java +++ b/designer-base/src/main/java/com/fr/decision/update/acquirer/AcquirerExecutorService.java @@ -1,8 +1,8 @@ package com.fr.decision.update.acquirer; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.decision.update.operate.AcquirerTask; -import com.fr.module.ModuleContext; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -16,7 +16,7 @@ import java.util.concurrent.Future; */ public class AcquirerExecutorService { - private static ExecutorService executorService = ModuleContext.getExecutor().newSingleThreadExecutor((new NamedThreadFactory("AcquirerExecutorService"))); + private static ExecutorService executorService = ComponentUtils.getExecutor().newSingleThreadExecutor((new NamedThreadFactory("AcquirerExecutorService"))); public static Future registerJob(AcquirerTask task) { return executorService.submit(task); diff --git a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java index 7eadc5760d..1a7f121cc5 100644 --- a/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java +++ b/designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java @@ -1,5 +1,6 @@ package com.fr.design.data; +import com.fanruan.ComponentUtils; import com.fanruan.config.impl.data.TableDataConfigProviderFactory; import com.fr.base.StoreProcedureParameter; import com.fr.base.TableData; @@ -33,7 +34,6 @@ import com.fr.general.ComparatorUtils; import com.fr.general.data.DataModel; import com.fr.general.data.TableDataException; import com.fr.log.FineLoggerFactory; -import com.fr.module.ModuleContext; import com.fr.script.Calculator; import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; @@ -582,7 +582,7 @@ public abstract class DesignTableDataManager { } catch (Exception e) { throw new TableDataException(e.getMessage(), e); } finally { - ScheduledExecutorService scheduledExecutorService = ModuleContext + ScheduledExecutorService scheduledExecutorService = ComponentUtils .getExecutor() .newSingleThreadScheduledExecutor(new NamedThreadFactory("")); scheduledExecutorService.schedule(new Runnable() { diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java index f3df21df9c..4cbf4eb540 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java @@ -15,7 +15,8 @@ import com.fr.esd.util.ESDUtils; import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.stable.StringUtils; -import com.fr.third.org.quartz.CronExpression; +import com.fr.third.v2.org.quartz.CronExpression; + import javax.swing.AbstractAction; import javax.swing.JPanel; diff --git a/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java index 258a6cf8a5..9b1d985087 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java +++ b/designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java @@ -1,6 +1,7 @@ package com.fr.design.dialog; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.DesignSizeI18nManager; @@ -9,7 +10,6 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.notification.Notification; import com.fr.design.notification.NotificationCenter; -import com.fr.module.ModuleContext; import com.fr.stable.StringUtils; import java.awt.BorderLayout; @@ -145,7 +145,7 @@ public class NotificationDialog extends JDialog { } private ScheduledExecutorService createScheduleExecutorService() { - return ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(HIDE_MSG)); + return ComponentUtils.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(HIDE_MSG)); } /** diff --git a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java index 916cd3cf6f..40e97aa2a6 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java +++ b/designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java @@ -1,5 +1,6 @@ package com.fr.design.gui.icombobox; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.TableProcedure; @@ -10,7 +11,6 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.mainframe.DesignerContext; import com.fr.log.FineLoggerFactory; -import com.fr.module.ModuleContext; import com.fr.stable.ArrayUtils; import com.fr.stable.Filter; import com.fr.stable.StringUtils; @@ -43,7 +43,7 @@ public class TableSearchTreeComboBox extends FRTreeComboBox { /** * 保证模糊搜索的原子性操作 */ - private final ExecutorService singleExecutor = ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory("TableSearchTreeComboBox")); + private final ExecutorService singleExecutor = ComponentUtils.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory("TableSearchTreeComboBox")); public TableSearchTreeComboBox(ChoosePane parent, JTree tree, TreeCellRenderer renderer) { super(tree, renderer); diff --git a/designer-base/src/main/java/com/fr/design/gui/style/FormatePaneNumField.java b/designer-base/src/main/java/com/fr/design/gui/style/FormatePaneNumField.java index dc706416c6..5990c7629c 100644 --- a/designer-base/src/main/java/com/fr/design/gui/style/FormatePaneNumField.java +++ b/designer-base/src/main/java/com/fr/design/gui/style/FormatePaneNumField.java @@ -1,9 +1,9 @@ package com.fr.design.gui.style; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.itextfield.UITextField; -import com.fr.module.ModuleContext; import com.fr.value.ClearableLazyValue; import org.jetbrains.annotations.NotNull; @@ -22,7 +22,7 @@ public class FormatePaneNumField extends UITextField { @NotNull @Override protected ScheduledExecutorService compute() { - return ModuleContext.getExecutor() + return ComponentUtils.getExecutor() .newSingleThreadScheduledExecutor(new NamedThreadFactory("FormatePaneNumFieldRunChange")); } }; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/AppGroup.java b/designer-base/src/main/java/com/fr/design/mainframe/AppGroup.java new file mode 100644 index 0000000000..e9cc9d55bb --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/AppGroup.java @@ -0,0 +1,13 @@ +package com.fr.design.mainframe; + +import com.fr.decision.service.context.MutableGroup; + +/** + * AppGroup + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +public class AppGroup extends MutableGroup { +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/AsyncThemeFetcher.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/AsyncThemeFetcher.java index 3df87ac658..bb559c232e 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/AsyncThemeFetcher.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/theme/AsyncThemeFetcher.java @@ -1,9 +1,9 @@ package com.fr.design.mainframe.theme; +import com.fanruan.ComponentUtils; import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateThemeConfig; import com.fr.concurrent.NamedThreadFactory; -import com.fr.module.ModuleContext; import javax.swing.SwingUtilities; import java.util.concurrent.ExecutorService; @@ -19,7 +19,7 @@ public class AsyncThemeFetcher { private final TemplateThemeConfig config; public AsyncThemeFetcher(int threads, TemplateThemeConfig config) { - this.executorService = ModuleContext.getExecutor().newFixedThreadPool( + this.executorService = ComponentUtils.getExecutor().newFixedThreadPool( threads, new NamedThreadFactory(this.getClass().getName()) ); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toast/SimpleToast.java b/designer-base/src/main/java/com/fr/design/mainframe/toast/SimpleToast.java index 3764cbcd83..2a3a43ac39 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toast/SimpleToast.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toast/SimpleToast.java @@ -1,10 +1,11 @@ package com.fr.design.mainframe.toast; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.dialog.UIDialog; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.module.ModuleContext; + import javax.swing.BorderFactory; import javax.swing.Icon; @@ -172,7 +173,7 @@ public class SimpleToast extends UIDialog { } private ScheduledExecutorService createToastScheduleExecutorService() { - return ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(TOAST_MSG_TIMER)); + return ComponentUtils.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(TOAST_MSG_TIMER)); } @Override diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java b/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java index 83cd84e9cc..d54765d7df 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java @@ -1,10 +1,10 @@ package com.fr.design.mainframe.toast; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.dialog.UIDialog; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; -import com.fr.module.ModuleContext; import javax.swing.JPanel; import java.awt.Dialog; @@ -118,7 +118,7 @@ public class ToastMsgDialog extends UIDialog { } private ScheduledExecutorService createToastScheduleExecutorService() { - return ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(TOAST_MSG_TIMER)); + return ComponentUtils.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(TOAST_MSG_TIMER)); } private void addMouseEvent(JPanel jPanel) { diff --git a/designer-base/src/main/java/com/fr/start/server/AnnotationConfigWebApplicationContextShell.java b/designer-base/src/main/java/com/fr/start/server/AnnotationConfigWebApplicationContextShell.java new file mode 100644 index 0000000000..970db69d9d --- /dev/null +++ b/designer-base/src/main/java/com/fr/start/server/AnnotationConfigWebApplicationContextShell.java @@ -0,0 +1,14 @@ +package com.fr.start.server; + +import com.fr.decision.service.context.SingletonShell; +import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; + +/** + * AnnotationConfigWebApplicationContextShell + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +public class AnnotationConfigWebApplicationContextShell extends SingletonShell { +} diff --git a/designer-base/src/main/java/com/fr/start/server/DesignEmbedHelper.java b/designer-base/src/main/java/com/fr/start/server/DesignEmbedHelper.java index c63c0747cb..844fcf6019 100644 --- a/designer-base/src/main/java/com/fr/start/server/DesignEmbedHelper.java +++ b/designer-base/src/main/java/com/fr/start/server/DesignEmbedHelper.java @@ -1,12 +1,12 @@ package com.fr.start.server; +import com.fanruan.carina.Carina; +import com.fanruan.carina.lifecycle.bootstrap.BootstrapFactory; import com.fr.cbb.websocket.core.WebSocketEndpoint; import com.fr.design.DesignerEnvManager; import com.fr.log.FineLoggerFactory; -import com.fr.module.ModuleRole; import com.fr.stable.EncodeConstants; import com.fr.stable.StringUtils; -import com.fr.third.guava.collect.Sets; import com.fr.third.springframework.web.SpringServletContainerInitializer; import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; import com.fr.workspace.WorkContext; @@ -164,13 +164,16 @@ public class DesignEmbedHelper { return contextPath; } private static void stopServerActivator() { - - ModuleRole.ServerRoot.stop(); + try { + BootstrapFactory.get().stop("fine_auth"); + } catch (Exception e) { + throw new RuntimeException(e); + } } private static void stopSpring() { - AnnotationConfigWebApplicationContext context = ModuleRole.ServerRoot.findSingleton(AnnotationConfigWebApplicationContext.class); + AnnotationConfigWebApplicationContext context = Carina.getApplicationContext().singleton(AnnotationConfigWebApplicationContextShell.class).get(); if (context != null) { context.stop(); context.destroy(); diff --git a/designer-base/src/main/java/com/fr/start/server/DesignEmbedLauncher.java b/designer-base/src/main/java/com/fr/start/server/DesignEmbedLauncher.java index 787892df56..b4e2be70cb 100644 --- a/designer-base/src/main/java/com/fr/start/server/DesignEmbedLauncher.java +++ b/designer-base/src/main/java/com/fr/start/server/DesignEmbedLauncher.java @@ -2,6 +2,7 @@ package com.fr.start.server; import com.fanruan.carina.Carina; import com.fanruan.carina.context.CarinaApplicationContext; +import com.fanruan.carina.exceptions.CarinaException; import com.fanruan.carina.launch.XmlCarinaLauncher; import javax.servlet.ServletContext; @@ -30,5 +31,9 @@ public class DesignEmbedLauncher extends XmlCarinaLauncher { return Carina.getApplicationContext(); } - + @Override + protected void initializeSpring() throws CarinaException { + super.initializeSpring(); + Carina.getApplicationContext().singleton(AnnotationConfigWebApplicationContextShell.class).set(springContext); + } } diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java index 971fa8d353..40a95758b5 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java @@ -2,7 +2,6 @@ package com.fr.start.server; import com.fanruan.carina.Carina; import com.fr.event.EventDispatcher; -import com.fr.module.ModuleContext; /** * Created by juhaoyu on 2018/6/6. diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java index 7ab5058f7e..8f063e2ad6 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java @@ -1,8 +1,8 @@ package com.fr.design.mainframe.chart.gui.style.series; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.gui.itextfield.UINumberField; -import com.fr.module.ModuleContext; import com.fr.value.ClearableLazyValue; import org.jetbrains.annotations.NotNull; @@ -22,7 +22,7 @@ public class ColorPickerPaneNumFiled extends UINumberField { @NotNull @Override protected ScheduledExecutorService compute() { - return ModuleContext.getExecutor() + return ComponentUtils.getExecutor() .newSingleThreadScheduledExecutor(new NamedThreadFactory("FormatePaneNumFieldRunChange")); } }; diff --git a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java index e989e1a364..8cf5cb24cf 100644 --- a/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java +++ b/designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java @@ -1,5 +1,6 @@ package com.fr.design.module; +import com.fanruan.ComponentUtils; import com.fr.base.ChartPreStyleConfig; import com.fr.base.svg.IconUtils; import com.fr.concurrent.NamedThreadFactory; @@ -9,7 +10,6 @@ import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerFrame; import com.fr.design.menu.MenuKeySet; -import com.fr.module.ModuleContext; import com.fr.transaction.CallBackAdaptor; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerFacade; @@ -28,7 +28,7 @@ import java.awt.event.ActionEvent; */ public class ChartPreStyleAction extends UpdateAction { - private static ExecutorService refreshDesignPool = ModuleContext.getExecutor().newFixedThreadPool( + private static ExecutorService refreshDesignPool = ComponentUtils.getExecutor().newFixedThreadPool( 10, new NamedThreadFactory("refreshChartStylePane")); public ChartPreStyleAction() { @@ -67,7 +67,7 @@ public class ChartPreStyleAction extends UpdateAction { if (refreshDesignPool.isTerminated()) { synchronized (refreshDesignPool) { if (refreshDesignPool.isTerminated()) { - refreshDesignPool = ModuleContext.getExecutor().newFixedThreadPool( + refreshDesignPool = ComponentUtils.getExecutor().newFixedThreadPool( 10, new NamedThreadFactory("refreshChartStylePane")); } } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java index 93b9f93403..82be535bea 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.share.ui.block; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.gui.ilable.UILabel; @@ -18,7 +19,6 @@ import com.fr.form.share.constants.ShareComponentConstants; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.general.FRScreen; -import com.fr.module.ModuleContext; import org.jetbrains.annotations.NotNull; import javax.swing.ImageIcon; import javax.swing.JPanel; @@ -58,7 +58,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe private static final double[] ANIMATE_CONTROL_VALUE = {0.23, 1, 0.32, 1}; private static final String FIRST_DRAG_ANIMATE = "first_drag_animate"; - private final ScheduledExecutorService firstDragCheckService = ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory("first_drag_check")); + private final ScheduledExecutorService firstDragCheckService = ComponentUtils.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory("first_drag_check")); public PreviewWidgetBlock(T widget) { @@ -269,7 +269,7 @@ public abstract class PreviewWidgetBlock extends JPanel implements MouseListe return; } animatePopupDialog = new AnimatePopupDialog(getCoverImage(), new Point(PreviewWidgetBlock.this.getLocationOnScreen().x, PreviewWidgetBlock.this.getLocationOnScreen().y)); - ScheduledExecutorService service = ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(FIRST_DRAG_ANIMATE)); + ScheduledExecutorService service = ComponentUtils.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(FIRST_DRAG_ANIMATE)); animate(service); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java index e275a1cdab..18ee4dcb41 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.share.ui.online.embed; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.ibutton.UIButton; @@ -13,7 +14,6 @@ import com.fr.design.mainframe.share.ui.widgetfilter.FilterConfigPane; import com.fr.design.mainframe.share.util.OnlineShopUtils; import com.fr.design.ui.util.UIUtil; import com.fr.design.mainframe.share.Bean.WidgetFilterInfo; -import com.fr.module.ModuleContext; import com.fr.stable.StringUtils; import javax.swing.BorderFactory; @@ -194,7 +194,7 @@ public class EmbedPane extends JPanel { } private ScheduledExecutorService createToastScheduleExecutorService() { - return ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(EMBED_PANE_TIMER)); + return ComponentUtils.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(EMBED_PANE_TIMER)); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java index def1056e96..8e6b6eeb95 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.share.ui.online.embed; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.mainframe.share.ui.online.AbstractOnlineWidgetSelectPane; @@ -11,7 +12,6 @@ import com.fr.form.share.constants.ShareComponentConstants; import com.fr.form.share.exception.NetWorkFailedException; import com.fr.general.http.HttpClient; import com.fr.log.FineLoggerFactory; -import com.fr.module.ModuleContext; import com.fr.stable.EncodeConstants; import com.fr.third.springframework.web.util.UriUtils; @@ -209,7 +209,7 @@ public class OnlineEmbedFilterSelectPane extends AbstractOnlineWidgetSelectPane } private ScheduledExecutorService createToastScheduleExecutorService() { - return ModuleContext.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(CAROUSEL_PREVIEW)); + return ComponentUtils.getExecutor().newSingleThreadScheduledExecutor(new NamedThreadFactory(CAROUSEL_PREVIEW)); } } diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java index e9c9d672db..49c3566b70 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java @@ -7,6 +7,7 @@ import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Stop; import com.fanruan.carina.annotions.Supplemental; +import com.fanruan.carina.core.partition.ResourceAffiliate; import com.fanruan.carina.lifecycle.bootstrap.BootstrapFactory; import com.fanruan.config.realm.ConfigRepositoryFactory; import com.fanruan.config.realm.local.LocalConfigRepositoryBuilder; @@ -103,7 +104,7 @@ import org.jetbrains.annotations.NotNull; * Created on 2024/6/6 */ @FineComponent(name = "design_env_choose") -public class DesignEnvChooseComponent { +public class DesignEnvChooseComponent extends ResourceAffiliate { private Listener beforeSwitch4Min = new Listener(Integer.MIN_VALUE) { @Override @@ -156,7 +157,6 @@ public class DesignEnvChooseComponent { @Stop public void stop() { editLockCheckerStop(); - stopListen(); } @@ -222,12 +222,12 @@ public class DesignEnvChooseComponent { private void registerEnvListener() { /*切换环境前,重启所有相关模块,最后执行*/ - EventDispatcher.listen(WorkspaceEvent.BeforeSwitch, beforeSwitch4Min); + listenEvent(WorkspaceEvent.BeforeSwitch, beforeSwitch4Min); /*切换环境前,存储一下打开的所有文件对象,要先于 关闭相关模块部分 被触发*/ - EventDispatcher.listen(WorkspaceEvent.BeforeSwitch, beforeSwitch4Max); + listenEvent(WorkspaceEvent.BeforeSwitch, beforeSwitch4Max); /*切换环境后,装载一下打开的所有文件对象,优先级低于默认优先级,要后于 启动相关模块部分 被触发*/ - EventDispatcher.listen(WorkspaceEvent.AfterSwitch, afterSwitch4Min); + listenEvent(WorkspaceEvent.AfterSwitch, afterSwitch4Min); } private void editLockCheckerStart() { @@ -236,7 +236,7 @@ public class DesignEnvChooseComponent { } private void pluginErrorRemind() { - EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { + listenEvent(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { @Override public void on(Event event, Null aNull) { PluginErrorDesignReminder.getInstance().remindStartFailedPlugins(); @@ -291,10 +291,5 @@ public class DesignEnvChooseComponent { } - private void stopListen() { - EventDispatcher.stopListen(beforeSwitch4Max); - EventDispatcher.stopListen(beforeSwitch4Min); - EventDispatcher.stopListen(afterSwitch4Min); - } } diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java index fe12dc02bc..949357cfec 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java @@ -8,6 +8,7 @@ import com.fanruan.carina.annotions.FineComponent; import com.fanruan.carina.annotions.JPAEntityScan; import com.fanruan.carina.annotions.Start; import com.fanruan.carina.annotions.Stop; +import com.fanruan.carina.annotions.Supplemental; import com.fanruan.config.ConfigProviderFactory; import com.fanruan.config.realm.ConfigRealm; import com.fanruan.dao.context.DBContextProvider; @@ -46,12 +47,24 @@ import com.fr.env.detect.EnvDetectorCenter; import com.fr.event.EventDispatcher; import com.fr.general.FRLogger; import com.fr.general.log.Log4jUtils; +import com.fr.intelli.metrics.Compute; +import com.fr.intelli.metrics.DBMonitorInterceptor; +import com.fr.intelli.metrics.MonitorInterceptor; +import com.fr.intelli.record.Focus; +import com.fr.intelli.record.FocusInterceptor; +import com.fr.intelli.record.PerformancePoint; +import com.fr.intelli.record.PerformancePointInterceptor; import com.fr.io.base.ResourcePaths; import com.fr.io.repository.ResourceRepository; import com.fr.io.repository.ResourceRepositoryWrapper; import com.fr.io.utils.ResourceIOUtils; import com.fr.log.FineLoggerFactory; +import com.fr.record.analyzer.AnalyzerConfiguration; +import com.fr.record.analyzer.AnalyzerKey; +import com.fr.record.analyzer.AnalyzerMutableGroup; +import com.fr.record.analyzer.Assistant; +import com.fr.record.analyzer.DBMetrics; import com.fr.security.encryption.EncryptionInitialization; import com.fr.security.encryption.core.EncryptionScaffold; import com.fr.security.encryption.provider.SecuritySeedProvider; @@ -62,6 +75,13 @@ import com.fr.stable.StringUtils; import com.fr.stable.db.DBContext; import com.fr.stable.db.properties.FineMicroServicesDBProperties; import com.fr.stable.project.ProjectConstants; +import com.fr.third.net.bytebuddy.description.type.TypeDescription; +import com.fr.third.net.bytebuddy.dynamic.DynamicType; +import com.fr.third.net.bytebuddy.implementation.MethodDelegation; +import com.fr.third.net.bytebuddy.matcher.ElementMatchers; +import com.fr.third.net.bytebuddy.utility.JavaModule; +import com.fr.tolerance.FaultTolerance; +import com.fr.tolerance.FaultToleranceInterceptor; import com.fr.transaction.Configurations; import com.fr.transaction.FineConfigurationHelper; import com.fr.transaction.HibernateTransactor; diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java index 16f77d0f89..43837f18e1 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java @@ -3,39 +3,28 @@ package com.fanruan.boot.env; import com.fanruan.carina.annotions.ActivatorRefer; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; -import com.fr.chart.activator.ChartBaseActivator; -import com.fr.data.DatasourceActivator; -import com.fr.design.chart.ChartDesignerActivator; -import com.fr.design.mainframe.app.DesignerAppActivator; -import com.fr.design.record.analyzer.DesignerAnalyzerActivator; -import com.fr.form.module.FormBaseActivator; -import com.fr.report.module.ReportBaseActivator; -import com.fr.start.module.DesignerActivator; -import com.fr.start.module.DesignerESDActivator; -import com.fr.start.module.optimized.DesignUpdateActivator; -import com.fr.workspace.server.vcs.VcsFolderManagerActivator; /** * 设计器基础功能组件,环境切换的上层模块 *

主要是图表、report、vcs、form相关的基础初始化

+ * 基础顺序 = { + * DesignUpdateActivator.class, + * DatasourceActivator.class, + * ChartBaseActivator.class, + * ReportBaseActivator.class, + * VcsFolderManagerActivator.class, + * FormBaseActivator.class, + * DesignerActivator.class, + * DesignerAppActivator.class, + * ChartDesignerActivator.class, + * DesignerESDActivator.class, + * DesignerAnalyzerActivator.class}) * * @author Destiny.Lin * @since 11.0 * Created on 2024/5/27 */ @FineComponent(name = "design_function") -@DependsOn(dependencies = {"design_plugin"}) -@ActivatorRefer(refer = { - DesignUpdateActivator.class, - DatasourceActivator.class, - ChartBaseActivator.class, - ReportBaseActivator.class, - VcsFolderManagerActivator.class, - FormBaseActivator.class, - DesignerActivator.class, - DesignerAppActivator.class, - ChartDesignerActivator.class, - DesignerESDActivator.class, - DesignerAnalyzerActivator.class}) +@DependsOn(dependencies = {"design_function_analyzer"}) public class DesignFunctionComponent { } diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/ChartDesignerComponent.java similarity index 72% rename from designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java rename to designer-realize/src/main/java/com/fanruan/boot/env/function/ChartDesignerComponent.java index 446ed1e616..abed4ff9f3 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/ChartDesignerComponent.java @@ -1,8 +1,16 @@ -package com.fr.design.chart; +package com.fanruan.boot.env.function; +import com.fanruan.carina.Carina; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Stop; +import com.fanruan.carina.annotions.Supplemental; import com.fr.chart.chartattr.ChartCollection; import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.actions.core.ActionFactory; +import com.fr.design.chart.AutoChartDialog; +import com.fr.design.chart.ChartDialog; import com.fr.design.chart.gui.ChartComponent; import com.fr.design.file.HistoryTemplateListCache; import com.fr.design.mainframe.ChartPropertyPane; @@ -12,8 +20,6 @@ import com.fr.form.ui.ChartEditor; import com.fr.locale.InterMutableKey; import com.fr.locale.LocaleMarker; import com.fr.locale.LocaleScope; -import com.fr.module.Activator; -import com.fr.module.extension.Prepare; import com.fr.plugin.chart.DownloadSourcesHelper; import com.fr.plugin.chart.vanchart.export.ImagePainter; import com.fr.stable.bridge.StableFactory; @@ -21,11 +27,20 @@ import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.van.chart.DownloadOnlineSourcesHelper; /** - * Created by juhaoyu on 2018/6/27. + * 设计器图表组件 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 */ -public class ChartDesignerActivator extends Activator implements Prepare { +@FineComponent(name = "design_function_chart") +@DependsOn(dependencies = "design_function_app") +public class ChartDesignerComponent { - @Override + /** + * start + */ + @Start public void start() { StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); @@ -53,11 +68,6 @@ public class ChartDesignerActivator extends Activator implements Prepare { @Override public void prepare() { - addMutable(InterMutableKey.Path, LocaleMarker.create("com/fr/design/i18n/chart", LocaleScope.DESIGN)); - } - - @Override - public void stop() { - + Carina.getApplicationContext().group(InterMutableKey.class).add(LocaleMarker.create("com/fr/design/i18n/chart", LocaleScope.DESIGN)); } } diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java new file mode 100644 index 0000000000..f2aba87c4e --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java @@ -0,0 +1,169 @@ +package com.fanruan.boot.env.function; + +import com.fanruan.analyzer.AnalyzerAssemblyShell; +import com.fanruan.carina.Carina; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Supplemental; +import com.fanruan.carina.core.partition.ResourceAffiliate; +import com.fr.base.OptimizeUtil; +import com.fr.collect.Collect; +import com.fr.concurrent.NamedThreadFactory; +import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.design.record.analyzer.DesignerAnalyzer; +import com.fr.design.record.analyzer.Interceptor.CollectInterceptor; +import com.fr.design.record.analyzer.advice.CollectAdvice; +import com.fr.design.record.analyzer.advice.DBMonitorAdvice; +import com.fr.design.record.analyzer.advice.FaultToleranceAdvice; +import com.fr.design.record.analyzer.advice.FocusAdvice; +import com.fr.design.record.analyzer.advice.MonitorAdvice; +import com.fr.design.record.analyzer.advice.PerformancePointAdvice; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.fr.event.Null; +import com.fr.intelli.metrics.Compute; +import com.fr.intelli.record.Focus; +import com.fr.intelli.record.PerformancePoint; +import com.fr.jvm.assist.FineAssist; +import com.fr.record.analyzer.AnalyzerConfiguration; +import com.fr.record.analyzer.AnalyzerKey; +import com.fr.record.analyzer.Assistant; +import com.fr.record.analyzer.DBMetrics; +import com.fr.record.analyzer.FineAnalyzer; +import com.fr.record.analyzer.advice.AnalyzerAdviceKey; +import com.fr.record.analyzer.advice.FineAdviceAssistant; +import com.fr.record.analyzer.configuration.AnalyzerAssemblyFactory; +import com.fr.record.analyzer.configuration.FineAnalyzerAssemblyFactory; +import com.fr.stable.collections.CollectionUtils; +import com.fr.third.net.bytebuddy.description.type.TypeDescription; +import com.fr.third.net.bytebuddy.dynamic.DynamicType; +import com.fr.third.net.bytebuddy.implementation.MethodDelegation; +import com.fr.third.net.bytebuddy.matcher.ElementMatchers; +import com.fr.third.net.bytebuddy.utility.JavaModule; +import com.fr.tolerance.FaultTolerance; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutorService; + +/** + * 设计器埋点及分析组件 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +@FineComponent(name = "design_function_analyzer") +@DependsOn(dependencies = "design_function_esd") +public class DesignAnalyzerComponent extends ResourceAffiliate { + + /** + * start + */ + @Start + public void start() { + + OptimizeUtil.open(OptimizeUtil.Module.ANALYZER,() -> { + + AnalyzerAssemblyFactory basicFactory = createBasicFactory(); + + // 兼容逻辑 + List backwardsConfigurations = new ArrayList<>(Carina.getApplicationContext().group(AnalyzerKey.class).getAll()); + if (!CollectionUtils.isEmpty(backwardsConfigurations)) { + // 直接初始化,不添加默认值,防止和下面的冲突 + FineAnalyzer.initDirectly(FineAssist.findInstrumentation(), basicFactory, backwardsConfigurations.toArray(new AnalyzerConfiguration[0])); + } + + // 等页面完全打开后,再进行 retransform, 别影响了启动速度 + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { + + @Override + public void on(Event event, Null param) { + + ExecutorService es = newSingleThreadExecutor(new NamedThreadFactory("designer-analyzer", true)); + try { + // 加入 retransform 部分的逻辑 + List adviceConfigurations = new ArrayList<>(Carina.getApplicationContext().group(AnalyzerAdviceKey.class).getAll()); + + if (!CollectionUtils.isEmpty(adviceConfigurations)) { + AnalyzerConfiguration[] configurations = convertConfigurations(adviceConfigurations); + es.submit(() -> { + DesignerAnalyzer.init(basicFactory, configurations); + }); + } + } finally { + es.shutdown(); + } + } + }); + }); + } + + @NotNull + private AnalyzerConfiguration[] convertConfigurations(List list) { + + return list.stream() + .map(AnalyzerConfiguration::create) + .toArray(AnalyzerConfiguration[]::new); + } + + + /** + * prepare + */ + @Supplemental + public void prepare() { + Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( + ElementMatchers.isAnnotatedWith(Focus.class), + FocusAdvice.class + )); + Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( + ElementMatchers.isAnnotatedWith(Compute.class), + MonitorAdvice.class + )); + Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( + ElementMatchers.isAnnotatedWith(DBMetrics.class), + DBMonitorAdvice.class + )); + Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( + ElementMatchers.isAnnotatedWith(PerformancePoint.class), + PerformancePointAdvice.class + )); + Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( + ElementMatchers.isAnnotatedWith(FaultTolerance.class), + FaultToleranceAdvice.class + )); + + // 保持M1 可用 + Carina.getApplicationContext().group(AnalyzerKey.class).add(AnalyzerConfiguration.create(new Assistant() { + + @Override + public DynamicType.Builder supply(DynamicType.Builder builder, TypeDescription typeDescription, ClassLoader classLoader, JavaModule module) { + + return builder + .method(ElementMatchers.isAnnotatedWith(Collect.class)) + .intercept(MethodDelegation.to(CollectInterceptor.class)); + } + })); + + Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( + ElementMatchers.isAnnotatedWith(Collect.class), + CollectAdvice.class + )); + + + + } + + + private AnalyzerAssemblyFactory createBasicFactory() { + + AnalyzerAssemblyFactory factory = Carina.getApplicationContext().singleton(AnalyzerAssemblyShell.class).get(); + FineAnalyzerAssemblyFactory basicFactory = new FineAnalyzerAssemblyFactory(); + basicFactory.prepare(factory); + return basicFactory; + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java new file mode 100644 index 0000000000..3a41a04c13 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java @@ -0,0 +1,47 @@ +package com.fanruan.boot.env.function; + +import com.fanruan.boot.ChartBaseComponent; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Stop; +import com.fanruan.carina.annotions.Supplemental; + + +/** + * DesignChartBaseComponent + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +@FineComponent(name = "design_function_chart_base") +@DependsOn(dependencies = "design_function_datasource") +public class DesignChartBaseComponent extends ChartBaseComponent { + + /** + * start + */ + @Start + public void start() { + super.start(); + } + + + /** + * stop + */ + @Stop + public void stop() { + super.stop(); + } + + /** + * prepare + */ + @Supplemental + public void prepare() { + super.prepare(); + } + +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java new file mode 100644 index 0000000000..9df73b3462 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java @@ -0,0 +1,585 @@ +package com.fanruan.boot.env.function; + +import com.fanruan.carina.Carina; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Stop; +import com.fanruan.carina.annotions.Supplemental; +import com.fanruan.config.bbs.FineBBSConfigProvider; +import com.fr.base.BaseFormula; +import com.fr.base.Formula; +import com.fr.base.MultiFieldParameter; +import com.fr.base.OptimizeUtil; +import com.fr.base.password.FinePassportListenerAdapter; +import com.fr.base.password.FinePassportManager; +import com.fr.base.process.ProcessOperator; +import com.fr.base.theme.migrator.FormThemeConfigMigrator; +import com.fr.base.theme.migrator.ReportThemeConfigMigrator; +import com.fr.chart.chartattr.ChartCollection; +import com.fr.config.ServerPreferenceConfig; +import com.fr.decision.update.backup.RecoverManager; +import com.fr.decision.webservice.v10.plugin.helper.category.impl.PluginResourceLoader; +import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; +import com.fr.design.DesignerEnvManager; +import com.fr.design.ExtraDesignClassManager; +import com.fr.design.actions.NewFormAction; +import com.fr.design.actions.core.ActionFactory; +import com.fr.design.actions.insert.cell.BiasCellAction; +import com.fr.design.actions.insert.cell.ChartCellAction; +import com.fr.design.actions.insert.cell.DSColumnCellAction; +import com.fr.design.actions.insert.cell.FormulaCellAction; +import com.fr.design.actions.insert.cell.GeneralCellAction; +import com.fr.design.actions.insert.cell.ImageCellAction; +import com.fr.design.actions.insert.cell.RichTextCellAction; +import com.fr.design.actions.insert.cell.SubReportCellAction; +import com.fr.design.actions.insert.flot.ChartFloatAction; +import com.fr.design.actions.insert.flot.FormulaFloatAction; +import com.fr.design.actions.insert.flot.ImageFloatAction; +import com.fr.design.actions.insert.flot.TextBoxFloatAction; +import com.fr.design.actions.replace.ITReplaceAction; +import com.fr.design.actions.replace.utils.ReplaceOperator; +import com.fr.design.bridge.DesignToolbarProvider; +import com.fr.design.constants.DesignerLaunchStatus; +import com.fr.design.env.DesignerWorkspaceLoader; +import com.fr.design.fit.NewJForm; +import com.fr.design.fit.common.TemplateTool; +import com.fr.design.form.parameter.FormParaDesigner; +import com.fr.design.fun.ElementUIProvider; +import com.fr.design.gui.controlpane.NameObjectCreator; +import com.fr.design.gui.controlpane.NameableCreator; +import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; +import com.fr.design.hyperlink.ReportletHyperlinkPane; +import com.fr.design.hyperlink.WebHyperlinkPane; +import com.fr.design.hyperlink.popup.MobilePopupPane; +import com.fr.design.i18n.DesignI18nImpl; +import com.fr.design.javascript.EmailPane; +import com.fr.design.javascript.JavaScriptImplPane; +import com.fr.design.javascript.ParameterJavaScriptPane; +import com.fr.design.javascript.ProcessTransitionAdapter; +import com.fr.design.login.DesignerLoginType; +import com.fr.design.login.guide.DesignerGuideHelper; +import com.fr.design.login.message.DesignerMessageHelper; +import com.fr.design.login.socketio.LoginAuthServer; +import com.fr.design.mainframe.BaseJForm; +import com.fr.design.mainframe.FormHierarchyTreePane; +import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl; +import com.fr.design.mainframe.InformationCollector; +import com.fr.design.mainframe.JTemplateEvent; +import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.mainframe.WidgetToolBarPane; +import com.fr.design.mainframe.alphafine.AlphaFineHelper; +import com.fr.design.mainframe.alphafine.question.QuestionWindow; +import com.fr.design.mainframe.alphafine.search.manager.impl.ProductNewsSearchManager; +import com.fr.design.mainframe.bbs.BBSGuestPane; +import com.fr.design.mainframe.bbs.UserInfoPane; +import com.fr.design.mainframe.form.FormECCompositeProvider; +import com.fr.design.mainframe.form.FormECDesignerProvider; +import com.fr.design.mainframe.form.FormElementCaseDesigner; +import com.fr.design.mainframe.form.FormReportComponentComposite; +import com.fr.design.mainframe.guide.GuideRegister; +import com.fr.design.mainframe.loghandler.DesignerLogAppender; +import com.fr.design.mainframe.share.constants.ShareEntryKey; +import com.fr.design.mainframe.socketio.DesignerSocketIO; +import com.fr.design.mod.ContentReplacerCenter; +import com.fr.design.module.DesignModuleFactory; +import com.fr.design.os.impl.SupportOSImpl; +import com.fr.design.parameter.FormParameterReader; +import com.fr.design.parameter.ParameterPropertyPane; +import com.fr.design.parameter.WorkBookParameterReader; +import com.fr.design.share.SharableManager; +import com.fr.design.share.ui.config.ShareConfigPane; +import com.fr.design.share.ui.generate.ShareGeneratePane; +import com.fr.design.update.actions.RecoverForDesigner; +import com.fr.design.update.push.DesignerPushUpdateManager; +import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.fr.event.Null; +import com.fr.general.GeneralContext; +import com.fr.general.xml.GeneralXMLTools; +import com.fr.js.EmailJavaScript; +import com.fr.js.JavaScriptImpl; +import com.fr.js.MobilePopupHyperlink; +import com.fr.js.ParameterJavaScript; +import com.fr.js.ReportletHyperlink; +import com.fr.js.WebHyperlink; +import com.fr.locale.InterMutableKey; +import com.fr.locale.LocaleMarker; +import com.fr.locale.LocaleScope; +import com.fr.log.FineLoggerFactory; +import com.fr.log.LogHandler; +import com.fr.plugin.beforeload.embed.DefaultPluginEmbedInfo; +import com.fr.plugin.beforeload.embed.PluginEmbedInfo; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.injectable.PluginModule; +import com.fr.plugin.manage.PluginFilter; +import com.fr.plugin.observer.PluginEvent; +import com.fr.plugin.observer.PluginEventListener; +import com.fr.quickeditor.cellquick.CellBiasTextPainterEditor; +import com.fr.quickeditor.cellquick.CellDSColumnEditor; +import com.fr.quickeditor.cellquick.CellFormulaQuickEditor; +import com.fr.quickeditor.cellquick.CellImageQuickEditor; +import com.fr.quickeditor.cellquick.CellRichTextEditor; +import com.fr.quickeditor.cellquick.CellStringQuickEditor; +import com.fr.quickeditor.cellquick.CellSubReportEditor; +import com.fr.quickeditor.chartquick.BasicChartQuickEditor; +import com.fr.quickeditor.chartquick.FloatChartQuickEditor; +import com.fr.quickeditor.floatquick.FloatImageQuickEditor; +import com.fr.quickeditor.floatquick.FloatStringQuickEditor; +import com.fr.report.cell.CellElementValueConverter; +import com.fr.report.cell.cellattr.core.RichText; +import com.fr.report.cell.cellattr.core.SubReport; +import com.fr.report.cell.cellattr.core.group.DSColumn; +import com.fr.report.cell.painter.BiasTextPainter; +import com.fr.report.cell.painter.CellImagePainter; +import com.fr.stable.ArrayUtils; +import com.fr.stable.ParameterProvider; +import com.fr.stable.bridge.StableFactory; +import com.fr.stable.os.support.OSBasedAction; +import com.fr.stable.os.support.OSSupportCenter; +import com.fr.stable.plugin.ExtraDesignClassManagerProvider; +import com.fr.stable.script.CalculatorProviderContext; +import com.fr.stable.script.ValueConverter; +import com.fr.stable.xml.ObjectTokenizer; +import com.fr.stable.xml.ObjectXMLWriterFinder; +import com.fr.start.BBSGuestPaneProvider; +import com.fr.start.common.DesignerStartupExecutor; +import com.fr.start.common.DesignerStartupPool; +import com.fr.task.Once; +import com.fr.workspace.WorkContext; +import com.fr.xml.ReportXMLUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.concurrent.CompletableFuture; + +/** + * DesignComponent + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +@FineComponent(name = "design_function_common") +@DependsOn(dependencies = "design_function_form_base") +public class DesignComponent { + + private LogHandler logHandler = null; + private static final String PLUGIN_EXPORT_IMAGE_SETTING = "com.fr.plugin.exportimagesettings.v11"; + private final Once pushUpdateTask = new Once(new Runnable() { + @Override + public void run() { + DesignerPushUpdateManager.getInstance().preparePushUpdate(); + DesignerGuideHelper.prepareShowGuideDialog(); + DesignerMessageHelper.getInstance().prepareShowMessage(); + } + }); + + private boolean hasUpdated = false; + + /** + * start + */ + @Start + public void start() { + + List markers = new ArrayList<>(Carina.getApplicationContext().group(InterMutableKey.class).getAll()); + for (LocaleMarker marker : markers) { + if (marker.match(LocaleScope.DESIGN)) { + DesignI18nImpl.getInstance().addResource(marker.getPath()); + } + } + + CompletableFuture themeConfigPrepare = CompletableFuture.runAsync(() -> { + FormThemeConfigMigrator.getInstance().upgrade(); + ReportThemeConfigMigrator.getInstance().upgrade(); + }, DesignerStartupPool.common()); + + CompletableFuture mainDesignerPrepare = CompletableFuture.runAsync(this::designerModuleStart, DesignerStartupPool.common()); + + CompletableFuture extendDesignerPrepare = CompletableFuture.runAsync(this::designerExtendStart, DesignerStartupPool.common()); + + CompletableFuture otherFeaturesPrepare = CompletableFuture.runAsync(() -> { + startBBSLoginAuthServer(); + migrateBBSInfoFromFineDB(); + OSSupportCenter.buildAction(new OSBasedAction() { + @Override + public void execute(Object... objects) { + UserInfoPane.getInstance().updateBBSUserInfo(); + } + }, SupportOSImpl.BBS_USER_LOGIN_PANE); + loadLogAppender(); + //DesignerSocketIO.update(); + DesignerWorkspaceLoader.init(); + storePassport(); + AlphaFineHelper.switchConfig4Locale(); + RecoverManager.register(new RecoverForDesigner()); + }, DesignerStartupPool.common()); + + CompletableFuture resourcePrepare = CompletableFuture.runAsync(() -> { + pushUpdateTask.run(); + if (WorkContext.getCurrent().isLocal()) { + PluginResourceLoader.INSTANCE.checkOldShopFile(); + UpmResourceLoader.INSTANCE.checkOldShopFile(); + } + }, DesignerStartupPool.common()); + + CompletableFuture + .allOf(mainDesignerPrepare, extendDesignerPrepare, themeConfigPrepare, otherFeaturesPrepare, resourcePrepare) + .join(); + } + + + private void loadLogAppender() { + logHandler = new LogHandler() { + final DesignerLogAppender logAppender = DesignerLogAppender.createDesignerLogAppender(); + + @Override + public DesignerLogAppender getHandler() { + return logAppender; + } + }; + logHandler.getHandler().start(); + FineLoggerFactory.getLogger().addLogAppender(logHandler); + } + + private void unloadLogAppender() { + if (logHandler != null) { + logHandler.getHandler().stop(); + FineLoggerFactory.getLogger().removeLogAppender(logHandler); + } + } + + private void designerModuleStart() { + + StableFactory.registerMarkedClass(ExtraDesignClassManagerProvider.XML_TAG, ExtraDesignClassManager.class); + ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement()); + ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement()); + DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes()); + + createPluginListener(); + justStartModules4Designer(); + + CalculatorProviderContext.setValueConverter(valueConverter()); + GeneralXMLTools.Object_Tokenizer = startXMLReadObjectTokenizer(); + GeneralXMLTools.Object_XML_Writer_Finder = startObjectXMLWriterFinder(); + addAdapterForPlate(); + + designerRegister(); + + } + + private void designerExtendStart() { + + SharableManager.start(); + InformationCollector.getInstance().collectStartTime(); + GuideRegister.register(); + } + + private void createPluginListener() { + GeneralContext.listenPluginRunningChanged(new PluginEventListener() { + @Override + public void on(PluginEvent event) { + ActionFactory.referCellInsertActionClass(actionsForInsertCellElement()); + ActionFactory.referFloatInsertActionClass(actionsForInsertFloatElement()); + } + }, new PluginFilter() { + @Override + public boolean accept(PluginContext context) { + return context.contain(PluginModule.ExtraDesign, ElementUIProvider.MARK_STRING); + } + }); + } + + private static Class[] actionsForInsertCellElement() { + List> classes = new ArrayList<>(); + Set providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); + for (ElementUIProvider provider : providers) { + classes.add(provider.actionForInsertCellElement()); + } + + return ArrayUtils.addAll(new Class[]{ + DSColumnCellAction.class, + GeneralCellAction.class, + RichTextCellAction.class, + FormulaCellAction.class, + ChartCellAction.class, + ImageCellAction.class, + BiasCellAction.class, + SubReportCellAction.class + }, classes.toArray(new Class[classes.size()])); + } + + private static Class[] actionsForInsertFloatElement() { + List> classes = new ArrayList<>(); + Set providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); + for (ElementUIProvider provider : providers) { + classes.add(provider.actionForInsertFloatElement()); + } + + return ArrayUtils.addAll(new Class[]{ + TextBoxFloatAction.class, + FormulaFloatAction.class, + ChartFloatAction.class, + ImageFloatAction.class + }, classes.toArray(new Class[classes.size()])); + } + + private static NameableCreator[] hyperlinkTypes() { + return new NameableCreator[]{ + new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Reportlet"), ReportletHyperlink.class, ReportletHyperlinkPane.ChartNoRename.class), + new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Email"), EmailJavaScript.class, EmailPane.class), + new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Web_Link"), WebHyperlink.class, WebHyperlinkPane.ChartNoRename.class), + new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_JavaScript_Dynamic_Parameters"), ParameterJavaScript.class, ParameterJavaScriptPane.ChartNoRename.class), + new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_JavaScript"), JavaScriptImpl.class, JavaScriptImplPane.ChartNoRename.class), + new NameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup"), MobilePopupHyperlink.class, MobilePopupPane.class), + }; + } + + + private static void justStartModules4Designer() { + formDesignerRegister(); + } + + /** + * CellElementValueConverter用来处理设计器格子里的值,将公式/数组/其他元素转换成对应的值。 + * + * @return 返回处理格子值的转换器 + */ + private static ValueConverter valueConverter() { + return new CellElementValueConverter(); + } + + /* + * 针对不同的对象,在读取Object对象的xml的时候需要使用不同的对象生成器 + * @return 返回对象生成器 + */ + private static ObjectTokenizer startXMLReadObjectTokenizer() { + return new ReportXMLUtils.ReportObjectTokenizer(); + } + + /** + * 针对不同的对象,在写对象的XML时需要使用不同的XML生成器 + * + * @return 返回xml生成器 + */ + private static ObjectXMLWriterFinder startObjectXMLWriterFinder() { + return new ReportXMLUtils.ReportObjectXMLWriterFinder(); + } + + + //wei:fs的模块中可能有需要设计器界面做设置的地方,在这边添加 + private static void addAdapterForPlate() { + + ProcessTransitionAdapter.setProcessTransitionAdapter(new ProcessTransitionAdapter() { + + @Override + protected String[] getTransitionNamesByBook(String book) { + return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getTransitionNamesByBook(book); + } + + @Override + protected String[] getParaNames(String book) { + return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParaNames(book); + } + + @Override + protected ParameterProvider[] getParas(String book) { + return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParas(book); + } + + @Override + protected MultiFieldParameter[] getAllMultiFieldParas(String book) { + return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getAllMultiFieldParas(book); + } + }); + } + + private static void designerRegister() { + registerCellEditor(); + registerFloatEditor(); + registerData4Form(); + registerOtherPane(); + } + + private static void registerOtherPane() { + StableFactory.registerMarkedClass(BBSGuestPaneProvider.XML_TAG, BBSGuestPane.class); + StableFactory.registerMarkedObject(HyperlinkGroupPaneActionProvider.XML_TAG, HyperlinkGroupPaneActionImpl.getInstance()); + } + + /** + * kunsnat:注册单元格选中Editor + */ + private static void registerCellEditor() { + + ActionFactory.registerAsyncInitCellEditorClass(String.class, CellStringQuickEditor.class); + ActionFactory.registerAsyncInitCellEditorClass(Number.class, CellStringQuickEditor.class); + ActionFactory.registerAsyncInitCellEditorClass(BaseFormula.class, CellFormulaQuickEditor.class); + ActionFactory.registerAsyncInitCellEditorClass(SubReport.class, CellSubReportEditor.class); + ActionFactory.registerAsyncInitCellEditorClass(RichText.class, CellRichTextEditor.class); + ActionFactory.registerAsyncInitCellEditorClass(DSColumn.class, CellDSColumnEditor.class); + ActionFactory.registerAsyncInitCellEditorClass(Image.class, CellImageQuickEditor.class); + ActionFactory.registerAsyncInitCellEditorClass(BiasTextPainter.class, CellBiasTextPainterEditor.class); + ActionFactory.registerAsyncInitCellEditorClass(BufferedImage.class, CellImageQuickEditor.class); + ActionFactory.registerAsyncInitCellEditorClass(CellImagePainter.class, CellImageQuickEditor.class); + + Set providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); + for (ElementUIProvider provider : providers) { + try { + if (provider.quickEditor() == null) { + continue; + } + ActionFactory.registerAsyncInitCellEditorClass(provider.targetObjectClass(), provider.quickEditor()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + } + + + /** + * kunnat: 注册悬浮选中Editor + */ + private static void registerFloatEditor() { + + ActionFactory.registerFloatEditor(String.class, new FloatStringQuickEditor()); + ActionFactory.registerFloatEditor(Formula.class, new FloatStringQuickEditor()); + ActionFactory.registerFloatEditor(Image.class, new FloatImageQuickEditor()); + ActionFactory.registerFloatEditor(BufferedImage.class, new FloatImageQuickEditor()); + ActionFactory.registerFloatEditor(CellImagePainter.class, new FloatImageQuickEditor()); + ActionFactory.registerFloatEditorClass(ChartCollection.class, FloatChartQuickEditor.class); + } + + + private static void registerData4Form() { + StableFactory.registerMarkedClass(FormECDesignerProvider.XML_TAG, FormElementCaseDesigner.class); + StableFactory.registerMarkedClass(FormECCompositeProvider.XML_TAG, FormReportComponentComposite.class); + StableFactory.registerMarkedClass(ShareEntryKey.SHARE_GENERATE, ShareGeneratePane.class); + StableFactory.registerMarkedClass(ShareEntryKey.SHARE_CONFIG, ShareConfigPane.class); + DesignModuleFactory.registerParameterReader(new WorkBookParameterReader()); + } + + + private static void formDesignerRegister() { + + StableFactory.registerMarkedObject(DesignToolbarProvider.STRING_MARKED, WidgetToolBarPane.getInstance()); + + DesignModuleFactory.registerNewFormActionClass(NewFormAction.class); + DesignModuleFactory.registerReplaceActionClass(ITReplaceAction.class); + DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class); + DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class); + DesignModuleFactory.registerFormHierarchyPaneClass(FormHierarchyTreePane.class); + DesignModuleFactory.registerWidgetPropertyPaneClass(WidgetPropertyPane.class); + DesignModuleFactory.registerButtonDetailPaneClass(FormSubmitButtonDetailPane.class); + + DesignModuleFactory.registerReplace(new ReplaceOperator()); + DesignModuleFactory.registerParameterReader(new FormParameterReader()); + + StableFactory.registerMarkedClass(BaseJForm.XML_TAG, NewJForm.class); + + registerJTemplateEvent(); + } + + private static void registerJTemplateEvent(){ + EventDispatcher.listen(JTemplateEvent.BEFORE_TEMPLATE_INIT, TemplateTool.getSwitchListener()); + EventDispatcher.listen(JTemplateEvent.BEFORE_TEMPLATE_ACTIVE, TemplateTool.getSwitchListener()); + } + + private static void storePassport() { + FinePassportManager.getInstance().storePassport(DesignerEnvManager.getEnvManager().getDesignerLoginUsername(), DesignerEnvManager.getEnvManager().getActivationKey()); + FinePassportManager.getInstance().addPassportListener(new FinePassportListenerAdapter() { + @Override + public void onLoginSuccess() { + FinePassportManager.getInstance().storePassport(DesignerEnvManager.getEnvManager().getDesignerLoginUsername(), DesignerEnvManager.getEnvManager().getActivationKey()); + } + }); + } + + private void migrateBBSInfoFromFineDB() { + if (!WorkContext.getCurrent().isLocal()) { + return; + } + DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); + if (manager.isCurrentVersionFirstLaunch()) { + int newUid = manager.getDesignerLoginUid(); + if (newUid > 0) { + return; + } + int oldUid = Carina.config(FineBBSConfigProvider.class).getBbsUid(); + if (oldUid > 0) { + manager.setDesignerLoginUid(oldUid); + manager.setDesignerLoginUsername(Carina.config(FineBBSConfigProvider.class).getBbsUsername()); + manager.setDesignerLoginAppId(Carina.config(FineBBSConfigProvider.class).getBbsAppId()); + manager.setDesignerLoginRefreshToken(Carina.config(FineBBSConfigProvider.class).getBbsRefreshToken()); + manager.setDesignerLastLoginTime(System.currentTimeMillis()); + manager.setLastLoginType(DesignerLoginType.NORMAL_LOGIN); + manager.setLastLoginAccount(Carina.config(FineBBSConfigProvider.class).getBbsUsername()); + manager.setCurrentVersionFirstLaunch(false); + DesignerEnvManager.getEnvManager().saveXMLFile(); + } + } + } + + /** + * stop + */ + @Stop + public void stop() { + unloadLogAppender(); + DesignerSocketIO.close(); + } + + /** + * prepare + */ + @Supplemental + public void prepare() { + if (!OptimizeUtil.isOpen()) { + LoginAuthServer.getInstance().compatibleStart(); + } + ContentReplacerCenter.getInstance().register(); + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { + @Override + public void on(com.fr.event.Event event, Null param) { + new SwingWorker() { + + @Override + protected Void doInBackground() throws Exception { + // 触发下cid 搜索 + ProductNewsSearchManager.getInstance().getProductNewsList(); + return null; + } + + @Override + protected void done() { + QuestionWindow.getInstance().setVisible(true); + } + }.execute(); + } + }); + prepareDefaultEmbedPluginInfo(); + } + + private void prepareDefaultEmbedPluginInfo() { + Carina.getApplicationContext().group(PluginEmbedInfo.class).add(DefaultPluginEmbedInfo.create(PLUGIN_EXPORT_IMAGE_SETTING)); + } + + private void startBBSLoginAuthServer() { + + OptimizeUtil.open(() -> { + // 设计器启动后启动 + EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener() { + @Override + public void on(Event event, Null param) { + LoginAuthServer.getInstance().start(); + } + }); + }); + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java new file mode 100644 index 0000000000..ba9d63055a --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java @@ -0,0 +1,45 @@ +package com.fanruan.boot.env.function; + +import com.fanruan.boot.DatasourceComponent; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Stop; +import com.fanruan.carina.annotions.Supplemental; + + +/** + * 设计器数据源组件 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +@FineComponent(name = "design_function_datasource") +@DependsOn(dependencies = "design_function_update") +public class DesignDatasourceComponent extends DatasourceComponent { + + /** + * prepare + */ + @Supplemental + public void prepare() { + super.prepare(); + } + + /** + * start + */ + @Start + public void start() { + super.start(); + } + + /** + * stop + */ + @Stop + public void stop() { + super.stop(); + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignESDComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignESDComponent.java new file mode 100644 index 0000000000..997be4837d --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignESDComponent.java @@ -0,0 +1,30 @@ +package com.fanruan.boot.env.function; + +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fr.esd.cache.manager.RecommendManager; +import com.fr.esd.core.strategy.config.service.StrategyConfigService; +import com.fr.esd.core.strategy.recomend.EnabledTemplateService; +import com.fr.esd.impl.strategy.config.service.DefaultStrategyConfigServiceProvider; + +/** + * 设计器ESD组件 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +@FineComponent(name = "design_function_esd") +@DependsOn(dependencies = "design_function_chart") +public class DesignESDComponent { + + /** + * start + */ + @Start + public void start() { + StrategyConfigService.setService(new DefaultStrategyConfigServiceProvider()); + EnabledTemplateService.getInstance().registerService(path -> RecommendManager.getInstance().findByPath(path) != null); + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignFormBaseComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignFormBaseComponent.java new file mode 100644 index 0000000000..2affbaa74b --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignFormBaseComponent.java @@ -0,0 +1,46 @@ +package com.fanruan.boot.env.function; + +import com.fanruan.boot.FormBaseComponent; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Stop; +import com.fanruan.carina.annotions.Supplemental; + +/** + * DesignFormBaseComponent + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +@FineComponent(name = "design_function_form_base") +@DependsOn(dependencies = "design_function_vcs_folder") +public class DesignFormBaseComponent extends FormBaseComponent { + + /** + * prepare + */ + @Supplemental + public void prepare() { + super.prepare(); + } + + + /** + * start + */ + @Start + public void start() { + super.start(); + } + + + /** + * stop + */ + @Stop + public void stop() { + super.stop(); + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignReportBaseComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignReportBaseComponent.java new file mode 100644 index 0000000000..7d2f3fd224 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignReportBaseComponent.java @@ -0,0 +1,35 @@ +package com.fanruan.boot.env.function; + +import com.fanruan.boot.ReportBaseComponent; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Stop; + +/** + * DesignReportBaseComponent + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +@FineComponent(name = "design_function_report_base") +@DependsOn(dependencies = "design_function_chart_base") +public class DesignReportBaseComponent extends ReportBaseComponent { + + /** + * start + */ + @Start + public void start() { + super.start(); + } + + /** + * stop + */ + @Stop + public void stop() { + super.stop(); + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignUpdateComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignUpdateComponent.java new file mode 100644 index 0000000000..7c6f1e774a --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignUpdateComponent.java @@ -0,0 +1,91 @@ +package com.fanruan.boot.env.function; + +import com.fanruan.carina.Carina; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Stop; +import com.fanruan.carina.annotions.Supplemental; +import com.fanruan.update.base.UpdateSourceGroup; +import com.fanruan.update.plugins.UpdatePluginConfigGroup; +import com.fr.start.common.DesignerStartupContext; +import com.fr.update.ResourceUpdateManager; +import com.fr.update.base.DefaultSourcePath; +import com.fr.update.base.FineUpdateUnit; +import com.fr.update.base.UpdateSourceManager; +import com.fr.update.base.UpdateSourcePath; +import com.fr.update.base.UpdateTaskTypes; +import com.fr.update.bridge.BasicUpdateBridge; +import com.fr.update.controller.BasicUpdateController; +import com.fr.update.factory.DefaultTaskFactory; +import com.fr.update.plugins.UpdateConfigPathManager; +import com.fr.update.plugins.UpdatePluginsConfigPath; + +import java.util.ArrayList; +import java.util.List; + +/** + * 设计器更新组件 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +@FineComponent(name = "design_function_update") +@DependsOn(dependencies = "design_plugin") +public class DesignUpdateComponent { + + /** + * start + */ + @Start + public void start() { + + if (DesignerStartupContext.getInstance().onWarmup()) { + try { + prepare4Start(); + FineUpdateUnit.makeNew(); + } catch (Throwable ignore) { + } + } else { + prepare4Start(); + ResourceUpdateManager.basicUpdateStart(); + } + } + + /** + * 添加一些预启动事项 + */ + protected void prepare4Start() { + + List paths = new ArrayList<>(Carina.getApplicationContext().group(UpdateSourceGroup.class).getAll()); + for (UpdateSourcePath path : paths) { + UpdateSourceManager.getInstance().add(path); + } + + // 自动更新配置文件 + List configPaths = new ArrayList<>(Carina.getApplicationContext().group(UpdatePluginConfigGroup.class).getAll()); + for (UpdatePluginsConfigPath path : configPaths) { + UpdateConfigPathManager.getInstance().add(path); + } + } + + /** + * stop + */ + @Stop + public void stop() { + + UpdateSourceManager.getInstance().clear(); + } + + /** + * prepare + */ + @Supplemental + public void prepare() { + Carina.getApplicationContext().group(UpdateSourceGroup.class).add(new DefaultSourcePath()); + BasicUpdateBridge.getInstance().registerController(new BasicUpdateController()); + BasicUpdateBridge.getInstance().registerTaskFactory(UpdateTaskTypes.Default, new DefaultTaskFactory()); + } +} diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignVcsFolderManagerComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignVcsFolderManagerComponent.java new file mode 100644 index 0000000000..f796a1a818 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignVcsFolderManagerComponent.java @@ -0,0 +1,26 @@ +package com.fanruan.boot.env.function; + +import com.fanruan.boot.VcsFolderManagerComponent; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; + +/** + * DesignVcsFolderManagerComponent + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +@FineComponent(name = "design_function_vcs_folder") +@DependsOn(dependencies = "design_function_report_base") +public class DesignVcsFolderManagerComponent extends VcsFolderManagerComponent { + + /** + * start + */ + @Start + public void start() { + super.start(); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/AbstractWorkBookApp.java similarity index 98% rename from designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java rename to designer-realize/src/main/java/com/fanruan/boot/env/function/app/AbstractWorkBookApp.java index 60ce295a35..5e7abebac9 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/AbstractWorkBookApp.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.app; +package com.fanruan.boot.env.function.app; import com.fr.base.Parameter; import com.fr.design.mainframe.App; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/CptApp.java similarity index 98% rename from designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java rename to designer-realize/src/main/java/com/fanruan/boot/env/function/app/CptApp.java index e4b85af22c..80aac569c7 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/CptApp.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.app; +package com.fanruan.boot.env.function.app; import com.fr.base.BaseUtils; import com.fr.base.Style; @@ -13,7 +13,6 @@ import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DecodeDialog; -import com.fr.design.mainframe.TemplateLockedHandler; import com.fr.design.ui.util.UIUtil; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.exception.DecryptTemplateException; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/CptxApp.java similarity index 98% rename from designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java rename to designer-realize/src/main/java/com/fanruan/boot/env/function/app/CptxApp.java index 95104e2f8e..246ec1dacb 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/CptxApp.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.app; +package com.fanruan.boot.env.function.app; import com.fr.base.chart.exception.ChartNotFoundException; import com.fr.base.extension.FileExtension; diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java new file mode 100644 index 0000000000..5892dd8660 --- /dev/null +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java @@ -0,0 +1,55 @@ +package com.fanruan.boot.env.function.app; + +import com.fanruan.carina.Carina; +import com.fanruan.carina.annotions.DependsOn; +import com.fanruan.carina.annotions.FineComponent; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Stop; +import com.fanruan.carina.annotions.Supplemental; +import com.fr.design.mainframe.App; +import com.fr.design.mainframe.AppGroup; +import com.fr.design.mainframe.JTemplateFactory; +import com.fr.nx.app.designer.CptxApp; + +import java.util.ArrayList; +import java.util.List; + +/** + * 设计器app组件 + * + * @author Destiny.Lin + * @since 11.0 + * Created on 2024/7/2 + */ +@FineComponent(name = "design_function_app") +@DependsOn(dependencies = "design_function_common") +public class DesignAppComponent { + + /** + * start + */ + @Start + public void start() { + + List appList = new ArrayList<>(Carina.getApplicationContext().group(AppGroup.class).getAll()); + for (App app : appList) { + JTemplateFactory.register(app); + } + PluginRemote.getInstance().start(); + } + + @Override + public void stop() { + + List appList = new ArrayList<>(Carina.getApplicationContext().group(AppGroup.class).getAll()); + for (App app : appList) { + JTemplateFactory.remove(app); + } + PluginRemote.getInstance().stop(); + } + + @Override + public void prepare() { + Carina.getApplicationContext().group(AppGroup.class).addAll(new CptApp(), new CptxApp(), new FormApp(), new XlsApp(), new XlsxApp()); + } +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignerAppUtils.java similarity index 98% rename from designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java rename to designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignerAppUtils.java index 0075ae0765..6d2e7fd2ba 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignerAppUtils.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.app; +package com.fanruan.boot.env.function.app; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.DialogActionAdapter; @@ -7,8 +7,7 @@ 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.fanruan.boot.env.function.app.PluginRemote.PluginStatus; import com.fr.locale.InterProviderFactory; import com.fr.plugin.context.PluginMarker; import com.fr.plugin.context.PluginMarkerAdapter; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/FormApp.java similarity index 93% rename from designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java rename to designer-realize/src/main/java/com/fanruan/boot/env/function/app/FormApp.java index 0ced38559b..aa55b16516 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/FormApp.java @@ -1,20 +1,16 @@ -package com.fr.design.mainframe.app; +package com.fanruan.boot.env.function.app; import com.fr.base.Parameter; import com.fr.base.chart.exception.ChartNotFoundException; import com.fr.base.io.XMLEncryptUtils; -import com.fr.base.theme.FineColorManager; import com.fr.base.theme.FineColorSynchronizer; -import com.fr.base.theme.TemplateThemeCompatible; import com.fr.design.DesignerEnvManager; import com.fr.design.fit.NewJForm; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.AbstractAppProvider; import com.fr.design.mainframe.BaseJForm; import com.fr.design.mainframe.DecodeDialog; -import com.fr.design.mainframe.JForm; import com.fr.design.mainframe.JTemplate; -import com.fr.design.mainframe.TemplateLockedHandler; import com.fr.design.worker.open.OpenResult; import com.fr.design.worker.open.OpenWorker; import com.fr.exception.DecryptTemplateException; @@ -22,9 +18,6 @@ import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.exception.TplLockedException; import com.fr.file.FILE; import com.fr.form.main.Form; -import com.fr.form.ui.container.WBorderLayout; -import com.fr.form.ui.container.WFitLayout; -import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.report.util.ReadXmlType; import com.fr.report.util.ReadXmlTypeLocalManager; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/PluginRemote.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/PluginRemote.java similarity index 98% rename from designer-realize/src/main/java/com/fr/design/mainframe/app/PluginRemote.java rename to designer-realize/src/main/java/com/fanruan/boot/env/function/app/PluginRemote.java index 4bd4bdccc3..9dd44c79e2 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/PluginRemote.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/PluginRemote.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.app; +package com.fanruan.boot.env.function.app; import com.fr.base.FRContext; import com.fr.json.JSONArray; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/XlsApp.java similarity index 97% rename from designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java rename to designer-realize/src/main/java/com/fanruan/boot/env/function/app/XlsApp.java index 5b135ccdfe..da4b8eba6d 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/XlsApp.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.app; +package com.fanruan.boot.env.function.app; import com.fr.base.extension.FileExtension; import com.fr.design.i18n.Toolkit; diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/XlsxApp.java similarity index 97% rename from designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java rename to designer-realize/src/main/java/com/fanruan/boot/env/function/app/XlsxApp.java index f5a5498cf8..1e53ac408b 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/XlsxApp.java @@ -1,4 +1,4 @@ -package com.fr.design.mainframe.app; +package com.fanruan.boot.env.function.app; import com.fr.base.extension.FileExtension; import com.fr.design.i18n.Toolkit; diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignSerializationComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignSerializationComponent.java index 647e63ec57..8aa9e35246 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignSerializationComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignSerializationComponent.java @@ -1,12 +1,31 @@ package com.fanruan.boot.init; -import com.fanruan.carina.annotions.ActivatorRefer; +import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; -import com.fr.json.serialization.JsonSerializationActivator; -import com.fr.register.XMLableActivator; -import com.fr.serialization.SerializationActivator; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Stop; +import com.fanruan.carina.annotions.Supplemental; +import com.fr.general.AbstractMethodTransfer; +import com.fr.general.FArray; +import com.fr.general.xml.GeneralXMLTools; +import com.fr.json.FArraySerializer; +import com.fr.json.FormulaSerializer; +import com.fr.json.SpecialDeserializer; +import com.fr.json.SpecialNodeTransformer; +import com.fr.json.revise.EmbedJson; +import com.fr.serialization.CommonSerializer; +import com.fr.serialization.CommonSerializerKey; +import com.fr.serialization.SerializerSummary; +import com.fr.serialization.XMLableSerializer; +import com.fr.stable.ArrayProvider; +import com.fr.stable.FormulaProvider; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLableReader; + +import java.util.ArrayList; +import java.util.List; /** @@ -18,6 +37,54 @@ import com.fr.serialization.SerializationActivator; */ @FineComponent(name = "design_serialization") @DependsOn(dependencies = {"design_load"}) -@ActivatorRefer(refer = {SerializationActivator.class, JsonSerializationActivator.class, XMLableActivator.class}) public class DesignSerializationComponent { + + /** + * prepare + */ + @Supplemental + public void prepare() { + Carina.getApplicationContext().group(CommonSerializerKey.class).add(XMLableSerializer.getInstance()); + FArray.registerWriteObjectMethod(new AbstractMethodTransfer() { + @Override + public Void call(Object... args) { + GeneralXMLTools.writeObject((XMLPrintWriter) args[0], args[1], (String) args[2]); + return null; + } + }); + FArray.registerReadObjectMethod(new AbstractMethodTransfer() { + @Override + public Object call(Object... args) { + return GeneralXMLTools.readObject((XMLableReader) args[0], (boolean) args[1]); + } + }); + } + + /** + * start + */ + @Start + public void start() { + List serializers = new ArrayList<>(Carina.getApplicationContext().group(CommonSerializerKey.class).getAll()); + for (int i = serializers.size() - 1; i >= 0; i--) { + SerializerSummary.getDefault().supply(serializers.get(i)); + } + SerializerSummary.getDefault().complete(); + + + EmbedJson.clearDeserializersCache(); + + EmbedJson.addSerializer(FormulaProvider.class, new FormulaSerializer()); + EmbedJson.addSerializer(ArrayProvider.class, new FArraySerializer()); + EmbedJson.addDeserializer(Object.class, new SpecialDeserializer()); + EmbedJson.addNodeTransformer(new SpecialNodeTransformer()); + } + + /** + * stop + */ + @Stop + public void stop() { + SerializerSummary.getDefault().reset(); + } } diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java index bfed6c5c22..be91ea3378 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java @@ -1,10 +1,39 @@ package com.fanruan.boot.init; +import com.fanruan.boot.env.function.app.DesignerAppUtils; +import com.fanruan.boot.key.ActivatorContextGroup; +import com.fanruan.boot.key.StartupArgsShell; +import com.fanruan.carina.Carina; import com.fanruan.carina.annotions.ActivatorRefer; import com.fanruan.carina.annotions.DependsOn; import com.fanruan.carina.annotions.FineComponent; -import com.fr.start.module.DesignerInitActivator; -import com.fr.start.module.optimized.DesignerStartupPageActivator; +import com.fanruan.carina.annotions.Start; +import com.fanruan.carina.annotions.Supplemental; +import com.fr.design.DesignerEnvManager; +import com.fr.design.PluginClassRefreshManager; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.ui.util.UIUtil; +import com.fr.io.repository.base.fs.FileSystemRepository; +import com.fr.io.utils.ResourceIOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.module.engine.base.ActivatorContext; +import com.fr.start.DesignerInitial; +import com.fr.start.SplashContext; +import com.fr.start.common.DesignerStartupContext; +import com.fr.start.module.StartupArgs; +import com.fr.start.preload.PreLoadService; +import com.fr.start.util.DesignerStartupPageUtil; +import com.fr.startup.metric.DesignerMetrics; +import com.fr.startup.metric.DesignerStartupModel; +import com.fr.startup.ui.StartupPageModel; +import com.fr.startup.ui.StartupPageWindow; +import com.fr.startup.ui.StartupWorkspaceBean; +import com.fr.third.org.apache.commons.lang3.time.StopWatch; +import com.fr.value.NotNullLazyValue; +import org.jetbrains.annotations.NotNull; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; /** * 设计器界面初始化模块 @@ -17,12 +46,204 @@ import com.fr.start.module.optimized.DesignerStartupPageActivator; */ @FineComponent(name = "design_init") @DependsOn(dependencies = {"design_work_context"}) -@ActivatorRefer(refer = { - DesignerInitActivator.class, - DesignerStartupPageActivator.class, -}) +/// 去除Activator +//@ActivatorRefer(refer = { +// DesignerInitActivator.class, +// DesignerStartupPageActivator.class, +//}) public class DesignerInitComponent { + private final NotNullLazyValue startupArgsValue = new NotNullLazyValue() { + + @NotNull + @Override + protected StartupArgs compute() { + return Carina.getApplicationContext().singleton(StartupArgsShell.class).get(); + } + }; + + /** + * 上下文 + */ + private final ActivatorContext activatorContext = new ActivatorContext(); + + private final CountDownLatch LATCH = new CountDownLatch(1); + + /** + * prepare + */ + @Supplemental + public void prepare() { + ResourceIOUtils.setUnderlying(FileSystemRepository.getSingleton()); + } + + /** + * start + */ + @Start + public void start() { + PluginClassRefreshManager.getInstance().load(); + DesignerAppUtils.initPluginAllActiveListener(); + DesignerInitial.init(Carina.getApplicationContext().singleton(StartupArgsShell.class).get().get()); + + DesignerStartupContext context = DesignerStartupContext.getInstance(); + context.setStartupArgs(startupArgsValue.getValue()); + if (context.isShowStartupPage()) { + showDesignerStartupPage(context); + } else { + startNonStartupPage(); + } + } + + private void startNonStartupPage() { + + StopWatch recorder = DesignerStartupContext.getRecorder(); + try { + DesignerStartupPageUtil.enterWorkspace(); + } catch (Exception e) { + throw new RuntimeException(e); + } + recordStartupEnd(recorder); + } + + private void showDesignerStartupPage(DesignerStartupContext context) { + + // 启动页关闭 + SplashContext.getInstance().hide(); + + // 即时暂停 + suspendRecorder(context); + + Carina.getApplicationContext().group(ActivatorContextGroup.class).add(activatorContext); + + PreLoadService.getInstance().waitForUI(); + + UIUtil.invokeLaterIfNeeded(() -> { + + StartupPageModel model = StartupPageModel.create(); + context.setStartupPageModel(model); + + StopWatch suspendWatch = new StopWatch(); + final Runnable recordSuspend = () -> { + long suspendTime = suspendWatch.getTime(TimeUnit.MILLISECONDS); + activatorContext.setSuspendTime(suspendTime); + }; + + // selectAndOpenLast + model.setOpenLastTemplateRunnable(() -> { + recordSuspend.run(); + context.setOpenLastFile(true); + handleModel(model); + launchAfterWarmup(); + }); + + // selectAndOpenEmpty + model.setOpenEmptyTemplateRunnable(() -> { + recordSuspend.run(); + context.setOpenEmpty(true); + handleModel(model); + launchAfterWarmup(); + }); + + // selectAndCreateNew + model.setCreateNewTemplateRunnable(() -> { + recordSuspend.run(); + context.setCreateNew(true); + handleModel(model); + launchAfterWarmup(); + }); + + StartupPageWindow window = new StartupPageWindow(model); + window.setVisible(true); + context.setOnWaiting(true); + suspendWatch.start(); + + }); + + waitSubTask(); + } + + private void suspendRecorder(DesignerStartupContext context) { + + DesignerMetrics designerMetrics = context.getDesignerMetrics(); + DesignerStartupModel designerStartupModel = designerMetrics.getModel(); + StopWatch recorder = DesignerStartupContext.getRecorder(); + recorder.suspend(); + long time = recorder.getTime(TimeUnit.MILLISECONDS); + designerStartupModel.setLandingTime(time); + } + + private void handleModel(StartupPageModel model) { + + // 将选中的环境设置为当前环境 + StartupWorkspaceBean selectWorkspaceInfo = model.getSelectWorkspaceInfo(); + DesignerEnvManager.getEnvManager().setCurEnvName(selectWorkspaceInfo.getName()); + UIUtil.invokeLaterIfNeeded(() -> { + DesignerContext.getDesignerFrame().setTitle(); + }); + } + + private void launchAfterWarmup() { + + StopWatch stopWatch = StopWatch.createStarted(); + + try { + + StopWatch recorder = DesignerStartupContext.getRecorder(); + if (recorder.isSuspended()) { + recorder.resume(); + } + + // 等待中切换 + DesignerStartupContext.getInstance().setOnWaiting(false); + + DesignerStartupContext.getInstance().setOnStartup(true); + try { + DesignerStartupPageUtil.enterWorkspace(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } finally { + UIUtil.invokeLaterIfNeeded(() -> { + // 换到 awt 线程中关闭,不然异步会出现问题。 + DesignerStartupContext.getInstance().setOnStartup(false); + recordStartupEnd(stopWatch); + }); + markComplete(); + } + + } + + private void recordStartupEnd(StopWatch stopWatch) { + + DesignerStartupContext context = DesignerStartupContext.getInstance(); + DesignerMetrics designerMetrics = context.getDesignerMetrics(); + DesignerStartupModel model = designerMetrics.getModel(); + model.setStartingTime(stopWatch.getTime(TimeUnit.MILLISECONDS)); + model.fill(); + } + + /** + * 阻塞住当前的方法。 + * 只有 UI 交互开始执行的时候,才会停止阻塞 + */ + private void waitSubTask() { + + try { + LATCH.await(); + } catch (InterruptedException e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + + private void markComplete() { + + try { + LATCH.countDown(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } } 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 deleted file mode 100644 index e09796201e..0000000000 --- a/designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.fr.design.mainframe.app; - -import com.fr.design.mainframe.App; -import com.fr.design.mainframe.JTemplateFactory; -import com.fr.module.Activator; -import com.fr.module.extension.Prepare; -import com.fr.nx.app.designer.CptxApp; - -import java.util.List; - -/** - * Created by juhaoyu on 2018/6/27. - */ -public class DesignerAppActivator extends Activator implements Prepare { - - @Override - public void start() { - - List appList = findMutable(App.KEY); - for (App app : appList) { - JTemplateFactory.register(app); - } - PluginRemote.getInstance().start(); - } - - @Override - public void stop() { - - List appList = findMutable(App.KEY); - for (App app : appList) { - JTemplateFactory.remove(app); - } - PluginRemote.getInstance().stop(); - } - - @Override - public void prepare() { - - addMutable(App.KEY, new CptApp(), new CptxApp(), new FormApp(), new XlsApp(), new XlsxApp()); - - } -} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartupMessageCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartupMessageCollector.java index 0ca2eb95ba..80ae1c18dd 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartupMessageCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartupMessageCollector.java @@ -1,5 +1,6 @@ package com.fr.design.mainframe.messagecollect; +import com.fanruan.ComponentUtils; import com.fr.concurrent.NamedThreadFactory; import com.fr.design.DesignerEnvManager; import com.fr.design.mainframe.SiteCenterToken; @@ -12,8 +13,6 @@ import com.fr.general.GeneralUtils; import com.fr.general.http.HttpToolbox; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; -import com.fr.module.ModuleContext; -import com.fr.module.engine.FineModule; import com.fr.runtime.FineRuntime; import com.fr.stable.StringUtils; @@ -49,37 +48,38 @@ public class StartupMessageCollector { } public void recordStartupLog() { - EventDispatcher.listen(FineRuntime.ApplicationEvent.AFTER_START, new Listener() { - - @Override - public void on(Event event, Long param) { - final String url = CloudCenter.getInstance().acquireUrlByKind(STARTUP_URL_KEY); - if (StringUtils.isEmpty(url)) { - return; - } - ExecutorService es = ModuleContext.getExecutor() - .newSingleThreadExecutor(new NamedThreadFactory("StartupMessageCollector")); - es.submit(new Runnable() { - @Override - public void run() { - FineModule root = (FineModule) ModuleContext.getRoot().getRoot(); - JSONObject profile = root.profile(); - if (profile.isEmpty()) { - return; - } - JSONObject json = JSONObject.create() - .put(XML_UUID, DesignerEnvManager.getEnvManager().getUUID()) - .put(XML_BUILD_NO, GeneralUtils.readBuildNO()) - .put(XML_STARTUP_TIME, FineRuntime.getAppStartTime() + FineRuntime.getStartingTime()) - .put(XML_STARTUP_COST, FineRuntime.getStartingTime()) - .put(XML_STARTUP_LOG, profile) - .put(XML_STARTUP_MEMORY, Runtime.getRuntime().maxMemory() / BYTE_TO_MB); - sendInfo(json, url + LOG_TYPE); - } - }); - es.shutdown(); - } - }); + /// 待与fbp沟通后提供新启动信息收集方式 +// EventDispatcher.listen(FineRuntime.ApplicationEvent.AFTER_START, new Listener() { +// +// @Override +// public void on(Event event, Long param) { +// final String url = CloudCenter.getInstance().acquireUrlByKind(STARTUP_URL_KEY); +// if (StringUtils.isEmpty(url)) { +// return; +// } +// ExecutorService es = ComponentUtils.getExecutor() +// .newSingleThreadExecutor(new NamedThreadFactory("StartupMessageCollector")); +// es.submit(new Runnable() { +// @Override +// public void run() { +// FineModule root = (FineModule) ModuleContext.getRoot().getRoot(); +// JSONObject profile = root.profile(); +// if (profile.isEmpty()) { +// return; +// } +// JSONObject json = JSONObject.create() +// .put(XML_UUID, DesignerEnvManager.getEnvManager().getUUID()) +// .put(XML_BUILD_NO, GeneralUtils.readBuildNO()) +// .put(XML_STARTUP_TIME, FineRuntime.getAppStartTime() + FineRuntime.getStartingTime()) +// .put(XML_STARTUP_COST, FineRuntime.getStartingTime()) +// .put(XML_STARTUP_LOG, profile) +// .put(XML_STARTUP_MEMORY, Runtime.getRuntime().maxMemory() / BYTE_TO_MB); +// sendInfo(json, url + LOG_TYPE); +// } +// }); +// es.shutdown(); +// } +// }); } private boolean sendInfo(JSONObject content, String url) { diff --git a/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java b/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java index d681d79261..ca5f2fc431 100644 --- a/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/CarinaDesigner.java @@ -1,5 +1,6 @@ package com.fr.start; +import com.fanruan.LaunchType; import com.fanruan.boot.key.StartupArgsShell; import com.fanruan.carina.Carina; import com.fanruan.carina.context.CarinaApplicationContext; @@ -42,6 +43,7 @@ public class CarinaDesigner extends MainDesigner{ Carina.setPartitionManager(manager); DesignLauncher.setContext(carinaApplicationContext); Carina.getApplicationContext().singleton(StartupArgsShell.class).set(new StartupArgs(args)); + Carina.getApplicationContext().singleton(LaunchType.class).set(LaunchType.DESIGNER); DesignLauncher launch = new DesignLauncher("/com/fr/config/starter/designer-startup-carina.xml"); try { FineLoggerFactory.getLogger().debug("Designer prepared.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS)); From 825e118477517262f8cfb12674c875a71a6ba2b3 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 3 Jul 2024 14:21:51 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=20REPORT-114392=20FR-FBP=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E9=80=82=E9=85=8D=20?= =?UTF-8?q?=E5=8E=BB=E9=99=A4Activator=E4=BD=93=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/boot/env/DesignEnvComponent.java | 21 +++++++++++++++++++ .../env/function/ChartDesignerComponent.java | 5 ++++- .../env/function/app/DesignAppComponent.java | 10 +++++++-- .../start/module/DesignerInitActivator.java | 2 +- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java index 949357cfec..d42a973282 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java @@ -109,6 +109,27 @@ import java.util.Objects; }) public class DesignEnvComponent { + /** + * prepare + */ + @Supplemental + public void prepare() { + Carina.getApplicationContext().group(AnalyzerMutableGroup.class).add(AnalyzerConfiguration.create((builder, typeDescription, classLoader, module) -> builder + .method(ElementMatchers.isAnnotatedWith(Focus.class)) + .intercept(MethodDelegation.to(FocusInterceptor.class)))); + Carina.getApplicationContext().group(AnalyzerMutableGroup.class).add(AnalyzerConfiguration.create((builder, typeDescription, classLoader, module) -> builder + .method(ElementMatchers.isAnnotatedWith(Compute.class)) + .intercept(MethodDelegation.to(MonitorInterceptor.class)))); + Carina.getApplicationContext().group(AnalyzerMutableGroup.class).add(AnalyzerConfiguration.create((builder, typeDescription, classLoader, module) -> builder + .method(ElementMatchers.isAnnotatedWith(DBMetrics.class)) + .intercept(MethodDelegation.to(DBMonitorInterceptor.class)))); + Carina.getApplicationContext().group(AnalyzerMutableGroup.class).add(AnalyzerConfiguration.create((builder, typeDescription, classLoader, module) -> builder + .method(ElementMatchers.isAnnotatedWith(PerformancePoint.class)) + .intercept(MethodDelegation.to(PerformancePointInterceptor.class)))); + Carina.getApplicationContext().group(AnalyzerMutableGroup.class).add(AnalyzerConfiguration.create((builder, typeDescription, classLoader, module) -> builder + .method(ElementMatchers.isAnnotatedWith(FaultTolerance.class)) + .intercept(MethodDelegation.to(FaultToleranceInterceptor.class)))); + } @Start public void start() throws Exception { diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/ChartDesignerComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/ChartDesignerComponent.java index abed4ff9f3..d710ca363d 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/ChartDesignerComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/ChartDesignerComponent.java @@ -66,7 +66,10 @@ public class ChartDesignerComponent { ChartTypeInterfaceManager.addPluginChangedListener(); } - @Override + /** + * prepare + */ + @Supplemental public void prepare() { Carina.getApplicationContext().group(InterMutableKey.class).add(LocaleMarker.create("com/fr/design/i18n/chart", LocaleScope.DESIGN)); } diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java index 5892dd8660..e2f59dba9c 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java @@ -38,7 +38,10 @@ public class DesignAppComponent { PluginRemote.getInstance().start(); } - @Override + /** + * stop + */ + @Stop public void stop() { List appList = new ArrayList<>(Carina.getApplicationContext().group(AppGroup.class).getAll()); @@ -48,7 +51,10 @@ public class DesignAppComponent { PluginRemote.getInstance().stop(); } - @Override + /** + * prepare + */ + @Supplemental public void prepare() { Carina.getApplicationContext().group(AppGroup.class).addAll(new CptApp(), new CptxApp(), new FormApp(), new XlsApp(), new XlsxApp()); } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java index af08df31d6..a3c271d3eb 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java @@ -3,7 +3,7 @@ package com.fr.start.module; import com.fanruan.boot.key.StartupArgsShell; import com.fanruan.carina.Carina; import com.fr.design.PluginClassRefreshManager; -import com.fr.design.mainframe.app.DesignerAppUtils; +import com.fanruan.boot.env.function.app.DesignerAppUtils; import com.fr.io.repository.base.fs.FileSystemRepository; import com.fr.io.utils.ResourceIOUtils; import com.fr.module.Activator; From b53b0b0de9e5a9a6c1d8a97f17fff7545315cd36 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 3 Jul 2024 15:19:05 +0800 Subject: [PATCH 3/5] =?UTF-8?q?REPORT-114392=20FR-FBP=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E9=80=82=E9=85=8D=20=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../env/function/DesignAnalyzerComponent.java | 17 ++--------- .../boot/env/function/DesignComponent.java | 28 ++++--------------- .../boot/init/DesignerInitComponent.java | 13 --------- 3 files changed, 9 insertions(+), 49 deletions(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java index f2aba87c4e..d92621d8ac 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java @@ -136,26 +136,15 @@ public class DesignAnalyzerComponent extends ResourceAffiliate { ElementMatchers.isAnnotatedWith(FaultTolerance.class), FaultToleranceAdvice.class )); - // 保持M1 可用 - Carina.getApplicationContext().group(AnalyzerKey.class).add(AnalyzerConfiguration.create(new Assistant() { - - @Override - public DynamicType.Builder supply(DynamicType.Builder builder, TypeDescription typeDescription, ClassLoader classLoader, JavaModule module) { - - return builder - .method(ElementMatchers.isAnnotatedWith(Collect.class)) - .intercept(MethodDelegation.to(CollectInterceptor.class)); - } - })); + Carina.getApplicationContext().group(AnalyzerKey.class).add(AnalyzerConfiguration.create((builder, typeDescription, classLoader, module) -> builder + .method(ElementMatchers.isAnnotatedWith(Collect.class)) + .intercept(MethodDelegation.to(CollectInterceptor.class)))); Carina.getApplicationContext().group(AnalyzerAdviceKey.class).add(FineAdviceAssistant.create( ElementMatchers.isAnnotatedWith(Collect.class), CollectAdvice.class )); - - - } diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java index 9df73b3462..4d67e77eee 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java @@ -151,7 +151,7 @@ import com.fr.task.Once; import com.fr.workspace.WorkContext; import com.fr.xml.ReportXMLUtils; -import javax.swing.*; +import javax.swing.SwingWorker; import java.awt.*; import java.awt.image.BufferedImage; import java.util.ArrayList; @@ -181,47 +181,34 @@ public class DesignComponent { } }); - private boolean hasUpdated = false; /** * start */ @Start public void start() { - List markers = new ArrayList<>(Carina.getApplicationContext().group(InterMutableKey.class).getAll()); for (LocaleMarker marker : markers) { if (marker.match(LocaleScope.DESIGN)) { DesignI18nImpl.getInstance().addResource(marker.getPath()); } } - CompletableFuture themeConfigPrepare = CompletableFuture.runAsync(() -> { FormThemeConfigMigrator.getInstance().upgrade(); ReportThemeConfigMigrator.getInstance().upgrade(); }, DesignerStartupPool.common()); - CompletableFuture mainDesignerPrepare = CompletableFuture.runAsync(this::designerModuleStart, DesignerStartupPool.common()); - CompletableFuture extendDesignerPrepare = CompletableFuture.runAsync(this::designerExtendStart, DesignerStartupPool.common()); - CompletableFuture otherFeaturesPrepare = CompletableFuture.runAsync(() -> { startBBSLoginAuthServer(); migrateBBSInfoFromFineDB(); - OSSupportCenter.buildAction(new OSBasedAction() { - @Override - public void execute(Object... objects) { - UserInfoPane.getInstance().updateBBSUserInfo(); - } - }, SupportOSImpl.BBS_USER_LOGIN_PANE); + OSSupportCenter.buildAction(objects -> UserInfoPane.getInstance().updateBBSUserInfo(), SupportOSImpl.BBS_USER_LOGIN_PANE); loadLogAppender(); - //DesignerSocketIO.update(); DesignerWorkspaceLoader.init(); storePassport(); AlphaFineHelper.switchConfig4Locale(); RecoverManager.register(new RecoverForDesigner()); }, DesignerStartupPool.common()); - CompletableFuture resourcePrepare = CompletableFuture.runAsync(() -> { pushUpdateTask.run(); if (WorkContext.getCurrent().isLocal()) { @@ -229,10 +216,7 @@ public class DesignComponent { UpmResourceLoader.INSTANCE.checkOldShopFile(); } }, DesignerStartupPool.common()); - - CompletableFuture - .allOf(mainDesignerPrepare, extendDesignerPrepare, themeConfigPrepare, otherFeaturesPrepare, resourcePrepare) - .join(); + CompletableFuture.allOf(mainDesignerPrepare, extendDesignerPrepare, themeConfigPrepare, otherFeaturesPrepare, resourcePrepare).join(); } @@ -356,7 +340,7 @@ public class DesignComponent { return new CellElementValueConverter(); } - /* + /** * 针对不同的对象,在读取Object对象的xml的时候需要使用不同的对象生成器 * @return 返回对象生成器 */ @@ -374,9 +358,9 @@ public class DesignComponent { } - //wei:fs的模块中可能有需要设计器界面做设置的地方,在这边添加 - private static void addAdapterForPlate() { + private static void addAdapterForPlate() { + //wei:fs的模块中可能有需要设计器界面做设置的地方,在这边添加 ProcessTransitionAdapter.setProcessTransitionAdapter(new ProcessTransitionAdapter() { @Override diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java index be91ea3378..ead264625a 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java @@ -107,28 +107,20 @@ public class DesignerInitComponent { } private void showDesignerStartupPage(DesignerStartupContext context) { - // 启动页关闭 SplashContext.getInstance().hide(); - // 即时暂停 suspendRecorder(context); - Carina.getApplicationContext().group(ActivatorContextGroup.class).add(activatorContext); - PreLoadService.getInstance().waitForUI(); - UIUtil.invokeLaterIfNeeded(() -> { - StartupPageModel model = StartupPageModel.create(); context.setStartupPageModel(model); - StopWatch suspendWatch = new StopWatch(); final Runnable recordSuspend = () -> { long suspendTime = suspendWatch.getTime(TimeUnit.MILLISECONDS); activatorContext.setSuspendTime(suspendTime); }; - // selectAndOpenLast model.setOpenLastTemplateRunnable(() -> { recordSuspend.run(); @@ -136,7 +128,6 @@ public class DesignerInitComponent { handleModel(model); launchAfterWarmup(); }); - // selectAndOpenEmpty model.setOpenEmptyTemplateRunnable(() -> { recordSuspend.run(); @@ -144,7 +135,6 @@ public class DesignerInitComponent { handleModel(model); launchAfterWarmup(); }); - // selectAndCreateNew model.setCreateNewTemplateRunnable(() -> { recordSuspend.run(); @@ -152,14 +142,11 @@ public class DesignerInitComponent { handleModel(model); launchAfterWarmup(); }); - StartupPageWindow window = new StartupPageWindow(model); window.setVisible(true); context.setOnWaiting(true); suspendWatch.start(); - }); - waitSubTask(); } From a1c8f3ac0bf4ca73250f0a0597f203c7920f9734 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 3 Jul 2024 15:22:08 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-114392=20FR-FBP=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E9=80=82=E9=85=8D=20=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/boot/init/DesignerInitComponent.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java index ead264625a..4a60bff503 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java @@ -113,6 +113,11 @@ public class DesignerInitComponent { suspendRecorder(context); Carina.getApplicationContext().group(ActivatorContextGroup.class).add(activatorContext); PreLoadService.getInstance().waitForUI(); + initUIUtilsTask(context); + waitSubTask(); + } + + private void initUIUtilsTask(DesignerStartupContext context) { UIUtil.invokeLaterIfNeeded(() -> { StartupPageModel model = StartupPageModel.create(); context.setStartupPageModel(model); @@ -147,7 +152,6 @@ public class DesignerInitComponent { context.setOnWaiting(true); suspendWatch.start(); }); - waitSubTask(); } private void suspendRecorder(DesignerStartupContext context) { From 81b5ed21b606a6288cb087a4232abb6a036fc148 Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Wed, 3 Jul 2024 15:26:06 +0800 Subject: [PATCH 5/5] =?UTF-8?q?REPORT-114392=20FR-FBP=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=AE=BE=E8=AE=A1=E9=80=82=E9=85=8D=20=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../boot/env/function/DesignComponent.java | 22 +++++----- .../boot/init/DesignerInitComponent.java | 42 +++++++++++-------- 2 files changed, 36 insertions(+), 28 deletions(-) diff --git a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java index 4d67e77eee..0afc229a09 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java @@ -199,16 +199,7 @@ public class DesignComponent { }, DesignerStartupPool.common()); CompletableFuture mainDesignerPrepare = CompletableFuture.runAsync(this::designerModuleStart, DesignerStartupPool.common()); CompletableFuture extendDesignerPrepare = CompletableFuture.runAsync(this::designerExtendStart, DesignerStartupPool.common()); - CompletableFuture otherFeaturesPrepare = CompletableFuture.runAsync(() -> { - startBBSLoginAuthServer(); - migrateBBSInfoFromFineDB(); - OSSupportCenter.buildAction(objects -> UserInfoPane.getInstance().updateBBSUserInfo(), SupportOSImpl.BBS_USER_LOGIN_PANE); - loadLogAppender(); - DesignerWorkspaceLoader.init(); - storePassport(); - AlphaFineHelper.switchConfig4Locale(); - RecoverManager.register(new RecoverForDesigner()); - }, DesignerStartupPool.common()); + CompletableFuture otherFeaturesPrepare = CompletableFuture.runAsync(() -> designerOtherStart(), DesignerStartupPool.common()); CompletableFuture resourcePrepare = CompletableFuture.runAsync(() -> { pushUpdateTask.run(); if (WorkContext.getCurrent().isLocal()) { @@ -219,6 +210,17 @@ public class DesignComponent { CompletableFuture.allOf(mainDesignerPrepare, extendDesignerPrepare, themeConfigPrepare, otherFeaturesPrepare, resourcePrepare).join(); } + private void designerOtherStart() { + startBBSLoginAuthServer(); + migrateBBSInfoFromFineDB(); + OSSupportCenter.buildAction(objects -> UserInfoPane.getInstance().updateBBSUserInfo(), SupportOSImpl.BBS_USER_LOGIN_PANE); + loadLogAppender(); + DesignerWorkspaceLoader.init(); + storePassport(); + AlphaFineHelper.switchConfig4Locale(); + RecoverManager.register(new RecoverForDesigner()); + } + private void loadLogAppender() { logHandler = new LogHandler() { diff --git a/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java index 4a60bff503..18f6bdb670 100644 --- a/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java +++ b/designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java @@ -127,26 +127,11 @@ public class DesignerInitComponent { activatorContext.setSuspendTime(suspendTime); }; // selectAndOpenLast - model.setOpenLastTemplateRunnable(() -> { - recordSuspend.run(); - context.setOpenLastFile(true); - handleModel(model); - launchAfterWarmup(); - }); + model.setOpenLastTemplateRunnable(() -> openLastTemplate(recordSuspend, context, model)); // selectAndOpenEmpty - model.setOpenEmptyTemplateRunnable(() -> { - recordSuspend.run(); - context.setOpenEmpty(true); - handleModel(model); - launchAfterWarmup(); - }); + model.setOpenEmptyTemplateRunnable(() -> openEmptyTemplate(recordSuspend, context, model)); // selectAndCreateNew - model.setCreateNewTemplateRunnable(() -> { - recordSuspend.run(); - context.setCreateNew(true); - handleModel(model); - launchAfterWarmup(); - }); + model.setCreateNewTemplateRunnable(() -> createNewTemplate(recordSuspend, context, model)); StartupPageWindow window = new StartupPageWindow(model); window.setVisible(true); context.setOnWaiting(true); @@ -154,6 +139,27 @@ public class DesignerInitComponent { }); } + private void createNewTemplate(Runnable recordSuspend, DesignerStartupContext context, StartupPageModel model) { + recordSuspend.run(); + context.setCreateNew(true); + handleModel(model); + launchAfterWarmup(); + } + + private void openEmptyTemplate(Runnable recordSuspend, DesignerStartupContext context, StartupPageModel model) { + recordSuspend.run(); + context.setOpenEmpty(true); + handleModel(model); + launchAfterWarmup(); + } + + private void openLastTemplate(Runnable recordSuspend, DesignerStartupContext context, StartupPageModel model) { + recordSuspend.run(); + context.setOpenLastFile(true); + handleModel(model); + launchAfterWarmup(); + } + private void suspendRecorder(DesignerStartupContext context) { DesignerMetrics designerMetrics = context.getDesignerMetrics();