Browse Source
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
50 changed files with 1614 additions and 193 deletions
@ -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> { |
||||||
|
} |
@ -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> { |
||||||
|
} |
@ -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; |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
} |
@ -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); |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
} |
@ -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()); |
||||||
|
} |
||||||
|
} |
@ -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(); |
||||||
|
} |
||||||
|
} |
@ -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.base.Parameter; |
||||||
import com.fr.design.mainframe.App; |
import com.fr.design.mainframe.App; |
@ -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.chart.exception.ChartNotFoundException; |
||||||
import com.fr.base.extension.FileExtension; |
import com.fr.base.extension.FileExtension; |
@ -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()); |
||||||
|
} |
||||||
|
} |
@ -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.base.FRContext; |
||||||
import com.fr.json.JSONArray; |
import com.fr.json.JSONArray; |
@ -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.base.extension.FileExtension; |
||||||
import com.fr.design.i18n.Toolkit; |
import com.fr.design.i18n.Toolkit; |
@ -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.base.extension.FileExtension; |
||||||
import com.fr.design.i18n.Toolkit; |
import com.fr.design.i18n.Toolkit; |
@ -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()); |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue