Browse Source

Pull request #14181: REPORT-114392 FR-FBP版本本地设计适配 去除Activator体系

Merge in DESIGN/design from ~DESTINY.LIN/design:fbp-1.0 to fbp-1.0

* commit '81b5ed21b606a6288cb087a4232abb6a036fc148':
  REPORT-114392 FR-FBP版本本地设计适配  代码质量
  REPORT-114392 FR-FBP版本本地设计适配  代码质量
  REPORT-114392 FR-FBP版本本地设计适配  代码质量
  REPORT-114392 FR-FBP版本本地设计适配 去除Activator体系
  REPORT-114392 FR-FBP版本本地设计适配 去除Activator体系
fbp-1.0
Destiny.Lin-林锦龙 5 months ago
parent
commit
e29c6afcdb
  1. 1
      build.gradle
  2. 4
      designer-base/src/main/java/com/fr/common/detect/CommonPortDetector.java
  3. 4
      designer-base/src/main/java/com/fr/decision/update/acquirer/AbstractAcquirer.java
  4. 4
      designer-base/src/main/java/com/fr/decision/update/acquirer/AcquirerExecutorService.java
  5. 4
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  6. 3
      designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java
  7. 4
      designer-base/src/main/java/com/fr/design/dialog/NotificationDialog.java
  8. 4
      designer-base/src/main/java/com/fr/design/gui/icombobox/TableSearchTreeComboBox.java
  9. 4
      designer-base/src/main/java/com/fr/design/gui/style/FormatePaneNumField.java
  10. 13
      designer-base/src/main/java/com/fr/design/mainframe/AppGroup.java
  11. 4
      designer-base/src/main/java/com/fr/design/mainframe/theme/AsyncThemeFetcher.java
  12. 5
      designer-base/src/main/java/com/fr/design/mainframe/toast/SimpleToast.java
  13. 4
      designer-base/src/main/java/com/fr/design/mainframe/toast/ToastMsgDialog.java
  14. 14
      designer-base/src/main/java/com/fr/start/server/AnnotationConfigWebApplicationContextShell.java
  15. 13
      designer-base/src/main/java/com/fr/start/server/DesignEmbedHelper.java
  16. 7
      designer-base/src/main/java/com/fr/start/server/DesignEmbedLauncher.java
  17. 1
      designer-base/src/main/java/com/fr/start/server/FineEmbedServer.java
  18. 4
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java
  19. 6
      designer-chart/src/main/java/com/fr/design/module/ChartPreStyleAction.java
  20. 6
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/block/PreviewWidgetBlock.java
  21. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/EmbedPane.java
  22. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/ui/online/embed/OnlineEmbedFilterSelectPane.java
  23. 17
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java
  24. 41
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  25. 37
      designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java
  26. 39
      designer-realize/src/main/java/com/fanruan/boot/env/function/ChartDesignerComponent.java
  27. 158
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java
  28. 47
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java
  29. 571
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java
  30. 45
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java
  31. 30
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignESDComponent.java
  32. 46
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignFormBaseComponent.java
  33. 35
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignReportBaseComponent.java
  34. 91
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignUpdateComponent.java
  35. 26
      designer-realize/src/main/java/com/fanruan/boot/env/function/DesignVcsFolderManagerComponent.java
  36. 2
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/AbstractWorkBookApp.java
  37. 3
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/CptApp.java
  38. 2
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/CptxApp.java
  39. 61
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java
  40. 5
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignerAppUtils.java
  41. 9
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/FormApp.java
  42. 2
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/PluginRemote.java
  43. 2
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/XlsApp.java
  44. 2
      designer-realize/src/main/java/com/fanruan/boot/env/function/app/XlsxApp.java
  45. 77
      designer-realize/src/main/java/com/fanruan/boot/init/DesignSerializationComponent.java
  46. 230
      designer-realize/src/main/java/com/fanruan/boot/init/DesignerInitComponent.java
  47. 42
      designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java
  48. 66
      designer-realize/src/main/java/com/fr/design/mainframe/messagecollect/StartupMessageCollector.java
  49. 2
      designer-realize/src/main/java/com/fr/start/CarinaDesigner.java
  50. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerInitActivator.java

1
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

4
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;

4
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;

4
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<String> registerJob(AcquirerTask task) {
return executorService.submit(task);

4
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() {

3
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;

4
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));
}
/**

4
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);

4
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"));
}
};

13
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<App> {
}

4
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<T extends TemplateTheme> {
private final TemplateThemeConfig<T> config;
public AsyncThemeFetcher(int threads, TemplateThemeConfig<T> config) {
this.executorService = ModuleContext.getExecutor().newFixedThreadPool(
this.executorService = ComponentUtils.getExecutor().newFixedThreadPool(
threads,
new NamedThreadFactory(this.getClass().getName())
);

5
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

4
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) {

14
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<AnnotationConfigWebApplicationContext> {
}

13
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();

7
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);
}
}

1
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.

4
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"));
}
};

6
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"));
}
}

6
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<T> 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<T> 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);
}

4
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));
}

4
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));
}
}

17
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvChooseComponent.java vendored

@ -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<Workspace> beforeSwitch4Min = new Listener<Workspace>(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<Null>() {
listenEvent(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@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);
}
}

41
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java vendored

@ -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;
@ -89,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 {

37
designer-realize/src/main/java/com/fanruan/boot/env/DesignFunctionComponent.java vendored

@ -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;
/**
* 设计器基础功能组件环境切换的上层模块
* <p>主要是图表reportvcsform相关的基础初始化</p>
* 基础顺序 = {
* 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 {
}

39
designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java → designer-realize/src/main/java/com/fanruan/boot/env/function/ChartDesignerComponent.java vendored

@ -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);
@ -51,13 +66,11 @@ public class ChartDesignerActivator extends Activator implements Prepare {
ChartTypeInterfaceManager.addPluginChangedListener();
}
@Override
/**
* prepare
*/
@Supplemental
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));
}
}

158
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignAnalyzerComponent.java vendored

@ -0,0 +1,158 @@
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<AnalyzerConfiguration> 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<Null>() {
@Override
public void on(Event event, Null param) {
ExecutorService es = newSingleThreadExecutor(new NamedThreadFactory("designer-analyzer", true));
try {
// 加入 retransform 部分的逻辑
List<FineAdviceAssistant> 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<FineAdviceAssistant> 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((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
));
}
private AnalyzerAssemblyFactory createBasicFactory() {
AnalyzerAssemblyFactory factory = Carina.getApplicationContext().singleton(AnalyzerAssemblyShell.class).get();
FineAnalyzerAssemblyFactory basicFactory = new FineAnalyzerAssemblyFactory();
basicFactory.prepare(factory);
return basicFactory;
}
}

47
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignChartBaseComponent.java vendored

@ -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();
}
}

571
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignComponent.java vendored

@ -0,0 +1,571 @@
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.SwingWorker;
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<DesignerLogAppender> 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();
}
});
/**
* start
*/
@Start
public void start() {
List<LocaleMarker> markers = new ArrayList<>(Carina.getApplicationContext().group(InterMutableKey.class).getAll());
for (LocaleMarker marker : markers) {
if (marker.match(LocaleScope.DESIGN)) {
DesignI18nImpl.getInstance().addResource(marker.getPath());
}
}
CompletableFuture<Void> themeConfigPrepare = CompletableFuture.runAsync(() -> {
FormThemeConfigMigrator.getInstance().upgrade();
ReportThemeConfigMigrator.getInstance().upgrade();
}, DesignerStartupPool.common());
CompletableFuture<Void> mainDesignerPrepare = CompletableFuture.runAsync(this::designerModuleStart, DesignerStartupPool.common());
CompletableFuture<Void> extendDesignerPrepare = CompletableFuture.runAsync(this::designerExtendStart, DesignerStartupPool.common());
CompletableFuture<Void> otherFeaturesPrepare = CompletableFuture.runAsync(() -> designerOtherStart(), DesignerStartupPool.common());
CompletableFuture<Void> 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 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<DesignerLogAppender>() {
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<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> 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<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> 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();
}
private static void addAdapterForPlate() {
//wei:fs的模块中可能有需要设计器界面做设置的地方,在这边添加
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<ElementUIProvider> 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<Null>() {
@Override
public void on(com.fr.event.Event event, Null param) {
new SwingWorker<Void, Void>() {
@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<Null>() {
@Override
public void on(Event event, Null param) {
LoginAuthServer.getInstance().start();
}
});
});
}
}

45
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignDatasourceComponent.java vendored

@ -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();
}
}

30
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignESDComponent.java vendored

@ -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);
}
}

46
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignFormBaseComponent.java vendored

@ -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();
}
}

35
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignReportBaseComponent.java vendored

@ -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();
}
}

91
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignUpdateComponent.java vendored

@ -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<UpdateSourcePath> paths = new ArrayList<>(Carina.getApplicationContext().group(UpdateSourceGroup.class).getAll());
for (UpdateSourcePath path : paths) {
UpdateSourceManager.getInstance().add(path);
}
// 自动更新配置文件
List<UpdatePluginsConfigPath> 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());
}
}

26
designer-realize/src/main/java/com/fanruan/boot/env/function/DesignVcsFolderManagerComponent.java vendored

@ -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();
}
}

2
designer-realize/src/main/java/com/fr/design/mainframe/app/AbstractWorkBookApp.java → designer-realize/src/main/java/com/fanruan/boot/env/function/app/AbstractWorkBookApp.java vendored

@ -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;

3
designer-realize/src/main/java/com/fr/design/mainframe/app/CptApp.java → designer-realize/src/main/java/com/fanruan/boot/env/function/app/CptApp.java vendored

@ -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;

2
designer-realize/src/main/java/com/fr/design/mainframe/app/CptxApp.java → designer-realize/src/main/java/com/fanruan/boot/env/function/app/CptxApp.java vendored

@ -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;

61
designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignAppComponent.java vendored

@ -0,0 +1,61 @@
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<App> appList = new ArrayList<>(Carina.getApplicationContext().group(AppGroup.class).getAll());
for (App app : appList) {
JTemplateFactory.register(app);
}
PluginRemote.getInstance().start();
}
/**
* stop
*/
@Stop
public void stop() {
List<App> appList = new ArrayList<>(Carina.getApplicationContext().group(AppGroup.class).getAll());
for (App app : appList) {
JTemplateFactory.remove(app);
}
PluginRemote.getInstance().stop();
}
/**
* prepare
*/
@Supplemental
public void prepare() {
Carina.getApplicationContext().group(AppGroup.class).addAll(new CptApp(), new CptxApp(), new FormApp(), new XlsApp(), new XlsxApp());
}
}

5
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppUtils.java → designer-realize/src/main/java/com/fanruan/boot/env/function/app/DesignerAppUtils.java vendored

@ -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;

9
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java → designer-realize/src/main/java/com/fanruan/boot/env/function/app/FormApp.java vendored

@ -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;

2
designer-realize/src/main/java/com/fr/design/mainframe/app/PluginRemote.java → designer-realize/src/main/java/com/fanruan/boot/env/function/app/PluginRemote.java vendored

@ -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;

2
designer-realize/src/main/java/com/fr/design/mainframe/app/XlsApp.java → designer-realize/src/main/java/com/fanruan/boot/env/function/app/XlsApp.java vendored

@ -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;

2
designer-realize/src/main/java/com/fr/design/mainframe/app/XlsxApp.java → designer-realize/src/main/java/com/fanruan/boot/env/function/app/XlsxApp.java vendored

@ -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;

77
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<Void>() {
@Override
public Void call(Object... args) {
GeneralXMLTools.writeObject((XMLPrintWriter) args[0], args[1], (String) args[2]);
return null;
}
});
FArray.registerReadObjectMethod(new AbstractMethodTransfer<Object>() {
@Override
public Object call(Object... args) {
return GeneralXMLTools.readObject((XMLableReader) args[0], (boolean) args[1]);
}
});
}
/**
* start
*/
@Start
public void start() {
List<CommonSerializer> 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();
}
}

230
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,201 @@ 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<StartupArgs> startupArgsValue = new NotNullLazyValue<StartupArgs>() {
@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();
initUIUtilsTask(context);
waitSubTask();
}
private void initUIUtilsTask(DesignerStartupContext context) {
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(() -> openLastTemplate(recordSuspend, context, model));
// selectAndOpenEmpty
model.setOpenEmptyTemplateRunnable(() -> openEmptyTemplate(recordSuspend, context, model));
// selectAndCreateNew
model.setCreateNewTemplateRunnable(() -> createNewTemplate(recordSuspend, context, model));
StartupPageWindow window = new StartupPageWindow(model);
window.setVisible(true);
context.setOnWaiting(true);
suspendWatch.start();
});
}
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();
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);
}
}
}

42
designer-realize/src/main/java/com/fr/design/mainframe/app/DesignerAppActivator.java

@ -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<App> appList = findMutable(App.KEY);
for (App app : appList) {
JTemplateFactory.register(app);
}
PluginRemote.getInstance().start();
}
@Override
public void stop() {
List<App> 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());
}
}

66
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<Long>() {
@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<Long>() {
//
// @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) {

2
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));

2
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;

Loading…
Cancel
Save