Browse Source

无JIRA任务 打包

persist/10.0
ju 6 years ago
parent
commit
51687dd770
  1. 144
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

144
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -52,7 +52,6 @@ import com.fr.design.mainframe.form.FormReportComponentComposite;
import com.fr.design.mainframe.loghandler.DesignerLogAppender; import com.fr.design.mainframe.loghandler.DesignerLogAppender;
import com.fr.design.mainframe.loghandler.LogMessageBar; import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.mainframe.socketio.DesignerSocketIO; import com.fr.design.mainframe.socketio.DesignerSocketIO;
import com.fr.design.mainframe.templateinfo.TemplateInfoCollector;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.FormParameterReader; import com.fr.design.parameter.FormParameterReader;
import com.fr.design.parameter.ParameterPropertyPane; import com.fr.design.parameter.ParameterPropertyPane;
@ -98,7 +97,6 @@ import com.fr.stable.script.ValueConverter;
import com.fr.stable.xml.ObjectTokenizer; import com.fr.stable.xml.ObjectTokenizer;
import com.fr.stable.xml.ObjectXMLWriterFinder; import com.fr.stable.xml.ObjectXMLWriterFinder;
import com.fr.start.BBSGuestPaneProvider; import com.fr.start.BBSGuestPaneProvider;
import com.fr.start.preload.ImagePreLoader;
import com.fr.xml.ReportXMLUtils; import com.fr.xml.ReportXMLUtils;
import java.awt.Image; import java.awt.Image;
@ -115,9 +113,9 @@ import java.util.concurrent.Executors;
* 之后慢慢将DesignerModule拆成Activator * 之后慢慢将DesignerModule拆成Activator
*/ */
public class DesignerActivator extends Activator { public class DesignerActivator extends Activator {
private LogHandler<DesignerLogAppender> logHandler = null; private LogHandler<DesignerLogAppender> logHandler = null;
@Override @Override
public void start() { public void start() {
List<LocaleMarker> markers = rightCollectMutable(InterMutableKey.Path); List<LocaleMarker> markers = rightCollectMutable(InterMutableKey.Path);
@ -132,11 +130,11 @@ public class DesignerActivator extends Activator {
DesignerSocketIO.update(); DesignerSocketIO.update();
UserInfoPane.getInstance().updateBBSUserInfo(); UserInfoPane.getInstance().updateBBSUserInfo();
} }
private void loadLogAppender() { private void loadLogAppender() {
logHandler = new LogHandler<DesignerLogAppender>() { logHandler = new LogHandler<DesignerLogAppender>() {
final DesignerLogAppender logAppender = new DesignerLogAppender(); final DesignerLogAppender logAppender = new DesignerLogAppender();
@Override @Override
public DesignerLogAppender getHandler() { public DesignerLogAppender getHandler() {
return logAppender; return logAppender;
@ -144,55 +142,41 @@ public class DesignerActivator extends Activator {
}; };
FineLoggerFactory.getLogger().addLogAppender(logHandler); FineLoggerFactory.getLogger().addLogAppender(logHandler);
} }
private void unloadLogAppender() { private void unloadLogAppender() {
if (logHandler != null) { if (logHandler != null) {
FineLoggerFactory.getLogger().removeLogAppender(logHandler); FineLoggerFactory.getLogger().removeLogAppender(logHandler);
} }
} }
private void designerModuleStart() { private void designerModuleStart() {
StableFactory.registerMarkedClass(ExtraDesignClassManagerProvider.XML_TAG, ExtraDesignClassManager.class); StableFactory.registerMarkedClass(ExtraDesignClassManagerProvider.XML_TAG, ExtraDesignClassManager.class);
ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement()); ActionFactory.registerCellInsertActionClass(actionsForInsertCellElement());
ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement()); ActionFactory.registerFloatInsertActionClass(actionsForInsertFloatElement());
DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes()); DesignModuleFactory.registerCreators4Hyperlink(hyperlinkTypes());
justStartModules4Designer(); justStartModules4Designer();
CalculatorProviderContext.setValueConverter(valueConverter()); CalculatorProviderContext.setValueConverter(valueConverter());
GeneralXMLTools.Object_Tokenizer = startXMLReadObjectTokenizer(); GeneralXMLTools.Object_Tokenizer = startXMLReadObjectTokenizer();
GeneralXMLTools.Object_XML_Writer_Finder = startObjectXMLWriterFinder(); GeneralXMLTools.Object_XML_Writer_Finder = startObjectXMLWriterFinder();
addAdapterForPlate(); addAdapterForPlate();
designerRegister(); designerRegister();
InformationCollector.getInstance().collectStartTime(); InformationCollector.getInstance().collectStartTime();
} }
private static void preLoadPane() { private static void preLoadPane() {
ExecutorService service = Executors.newCachedThreadPool(); ExecutorService service = Executors.newCachedThreadPool();
service.submit(new Runnable() {
@Override
public void run() {
new ImagePreLoader();
}
});
service.submit(new Runnable() {
@Override
public void run() {
TemplateInfoCollector.getInstance();
}
});
service.submit(new Runnable() { service.submit(new Runnable() {
@Override @Override
public void run() { public void run() {
LogMessageBar.getInstance(); LogMessageBar.getInstance();
} }
}); });
service.submit(new Runnable() { service.submit(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -217,7 +201,7 @@ public class DesignerActivator extends Activator {
DesignerFrameFileDealerPane.getInstance();//这边会涉及到TemplateTreePane DesignerFrameFileDealerPane.getInstance();//这边会涉及到TemplateTreePane
} }
}); });
service.submit(new Runnable() { service.submit(new Runnable() {
@Override @Override
public void run() { public void run() {
@ -226,26 +210,26 @@ public class DesignerActivator extends Activator {
}); });
service.shutdown(); service.shutdown();
} }
private static Class<?>[] actionsForInsertCellElement() { private static Class<?>[] actionsForInsertCellElement() {
List<Class<?>> classes = new ArrayList<>(); List<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) { for (ElementUIProvider provider : providers) {
classes.add(provider.actionForInsertCellElement()); classes.add(provider.actionForInsertCellElement());
} }
return ArrayUtils.addAll(new Class<?>[]{ return ArrayUtils.addAll(new Class<?>[]{
DSColumnCellAction.class, DSColumnCellAction.class,
GeneralCellAction.class, GeneralCellAction.class,
RichTextCellAction.class, RichTextCellAction.class,
FormulaCellAction.class, FormulaCellAction.class,
ChartCellAction.class, ChartCellAction.class,
ImageCellAction.class, ImageCellAction.class,
BiasCellAction.class, BiasCellAction.class,
SubReportCellAction.class SubReportCellAction.class
}, classes.toArray(new Class<?>[classes.size()])); }, classes.toArray(new Class<?>[classes.size()]));
} }
private static Class<?>[] actionsForInsertFloatElement() { private static Class<?>[] actionsForInsertFloatElement() {
List<Class<?>> classes = new ArrayList<>(); List<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
@ -253,28 +237,28 @@ public class DesignerActivator extends Activator {
classes.add(provider.actionForInsertFloatElement()); classes.add(provider.actionForInsertFloatElement());
} }
return ArrayUtils.addAll(new Class<?>[]{ return ArrayUtils.addAll(new Class<?>[]{
TextBoxFloatAction.class, TextBoxFloatAction.class,
FormulaFloatAction.class, FormulaFloatAction.class,
ChartFloatAction.class, ChartFloatAction.class,
ImageFloatAction.class ImageFloatAction.class
}, classes.toArray(new Class<?>[classes.size()])); }, classes.toArray(new Class<?>[classes.size()]));
} }
private static NameableCreator[] hyperlinkTypes() { private static NameableCreator[] hyperlinkTypes() {
return new NameableCreator[]{ 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_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_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_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_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("Fine-Design_Report_JavaScript"), JavaScriptImpl.class, JavaScriptImplPane.ChartNoRename.class)
}; };
} }
private static void justStartModules4Designer() { private static void justStartModules4Designer() {
formDesignerRegister(); formDesignerRegister();
} }
/** /**
* CellElementValueConverter用来处理设计器格子里的值将公式/数组/其他元素转换成对应的值 * CellElementValueConverter用来处理设计器格子里的值将公式/数组/其他元素转换成对应的值
* *
@ -283,7 +267,7 @@ public class DesignerActivator extends Activator {
private static ValueConverter valueConverter() { private static ValueConverter valueConverter() {
return new CellElementValueConverter(); return new CellElementValueConverter();
} }
/* /*
* 针对不同的对象在读取Object对象的xml的时候需要使用不同的对象生成器 * 针对不同的对象在读取Object对象的xml的时候需要使用不同的对象生成器
* @return 返回对象生成器 * @return 返回对象生成器
@ -291,7 +275,7 @@ public class DesignerActivator extends Activator {
private static ObjectTokenizer startXMLReadObjectTokenizer() { private static ObjectTokenizer startXMLReadObjectTokenizer() {
return new ReportXMLUtils.ReportObjectTokenizer(); return new ReportXMLUtils.ReportObjectTokenizer();
} }
/** /**
* 针对不同的对象在写对象的XML时需要使用不同的XML生成器 * 针对不同的对象在写对象的XML时需要使用不同的XML生成器
* *
@ -300,51 +284,51 @@ public class DesignerActivator extends Activator {
private static ObjectXMLWriterFinder startObjectXMLWriterFinder() { private static ObjectXMLWriterFinder startObjectXMLWriterFinder() {
return new ReportXMLUtils.ReportObjectXMLWriterFinder(); return new ReportXMLUtils.ReportObjectXMLWriterFinder();
} }
//wei:fs的模块中可能有需要设计器界面做设置的地方,在这边添加 //wei:fs的模块中可能有需要设计器界面做设置的地方,在这边添加
private static void addAdapterForPlate() { private static void addAdapterForPlate() {
ProcessTransitionAdapter.setProcessTransitionAdapter(new ProcessTransitionAdapter() { ProcessTransitionAdapter.setProcessTransitionAdapter(new ProcessTransitionAdapter() {
@Override @Override
protected String[] getTransitionNamesByBook(String book) { protected String[] getTransitionNamesByBook(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getTransitionNamesByBook(book); return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getTransitionNamesByBook(book);
} }
@Override @Override
protected String[] getParaNames(String book) { protected String[] getParaNames(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParaNames(book); return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParaNames(book);
} }
@Override @Override
protected ParameterProvider[] getParas(String book) { protected ParameterProvider[] getParas(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParas(book); return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getParas(book);
} }
@Override @Override
protected MultiFieldParameter[] getAllMultiFieldParas(String book) { protected MultiFieldParameter[] getAllMultiFieldParas(String book) {
return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getAllMultiFieldParas(book); return StableFactory.getMarkedObject(ProcessOperator.MARK_STRING, ProcessOperator.class, ProcessOperator.EMPTY).getAllMultiFieldParas(book);
} }
}); });
} }
private static void designerRegister() { private static void designerRegister() {
registerCellEditor(); registerCellEditor();
registerFloatEditor(); registerFloatEditor();
registerData4Form(); registerData4Form();
registerOtherPane(); registerOtherPane();
} }
private static void registerOtherPane() { private static void registerOtherPane() {
StableFactory.registerMarkedClass(BBSGuestPaneProvider.XML_TAG, BBSGuestPane.class); StableFactory.registerMarkedClass(BBSGuestPaneProvider.XML_TAG, BBSGuestPane.class);
} }
/** /**
* kunsnat:注册单元格选中Editor * kunsnat:注册单元格选中Editor
*/ */
private static void registerCellEditor() { private static void registerCellEditor() {
ActionFactory.registerCellEditor(String.class, new CellStringQuickEditor()); ActionFactory.registerCellEditor(String.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(Number.class, new CellStringQuickEditor()); ActionFactory.registerCellEditor(Number.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(BaseFormula.class, new CellFormulaQuickEditor()); ActionFactory.registerCellEditor(BaseFormula.class, new CellFormulaQuickEditor());
@ -357,7 +341,7 @@ public class DesignerActivator extends Activator {
ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor()); ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor());
//todo 图表编辑器populate没能实现刷新面板显示 //todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerCellEditorClass(ChartCollection.class, BasicChartQuickEditor.class); ActionFactory.registerCellEditorClass(ChartCollection.class, BasicChartQuickEditor.class);
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING); Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) { for (ElementUIProvider provider : providers) {
try { try {
@ -367,13 +351,13 @@ public class DesignerActivator extends Activator {
} }
} }
} }
/** /**
* kunnat: 注册悬浮选中Editor * kunnat: 注册悬浮选中Editor
*/ */
private static void registerFloatEditor() { private static void registerFloatEditor() {
ActionFactory.registerFloatEditor(String.class, new FloatStringQuickEditor()); ActionFactory.registerFloatEditor(String.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditor(Formula.class, new FloatStringQuickEditor()); ActionFactory.registerFloatEditor(Formula.class, new FloatStringQuickEditor());
ActionFactory.registerFloatEditor(Image.class, new FloatImageQuickEditor()); ActionFactory.registerFloatEditor(Image.class, new FloatImageQuickEditor());
@ -382,19 +366,19 @@ public class DesignerActivator extends Activator {
//todo 图表编辑器populate没能实现刷新面板显示 //todo 图表编辑器populate没能实现刷新面板显示
ActionFactory.registerFloatEditorClass(ChartCollection.class, FloatChartQuickEditor.class); ActionFactory.registerFloatEditorClass(ChartCollection.class, FloatChartQuickEditor.class);
} }
private static void registerData4Form() { private static void registerData4Form() {
StableFactory.registerMarkedClass(FormECDesignerProvider.XML_TAG, FormElementCaseDesigner.class); StableFactory.registerMarkedClass(FormECDesignerProvider.XML_TAG, FormElementCaseDesigner.class);
StableFactory.registerMarkedClass(FormECCompositeProvider.XML_TAG, FormReportComponentComposite.class); StableFactory.registerMarkedClass(FormECCompositeProvider.XML_TAG, FormReportComponentComposite.class);
DesignModuleFactory.registerParameterReader(new WorkBookParameterReader()); DesignModuleFactory.registerParameterReader(new WorkBookParameterReader());
} }
private static void formDesignerRegister() { private static void formDesignerRegister() {
StableFactory.registerMarkedObject(DesignToolbarProvider.STRING_MARKED, WidgetToolBarPane.getInstance()); StableFactory.registerMarkedObject(DesignToolbarProvider.STRING_MARKED, WidgetToolBarPane.getInstance());
DesignModuleFactory.registerNewFormActionClass(NewFormAction.class); DesignModuleFactory.registerNewFormActionClass(NewFormAction.class);
DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class); DesignModuleFactory.registerFormParaDesignerClass(FormParaDesigner.class);
DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class); DesignModuleFactory.registerParaPropertyPaneClass(ParameterPropertyPane.class);
@ -402,12 +386,12 @@ public class DesignerActivator extends Activator {
DesignModuleFactory.registerWidgetPropertyPaneClass(WidgetPropertyPane.class); DesignModuleFactory.registerWidgetPropertyPaneClass(WidgetPropertyPane.class);
DesignModuleFactory.registerButtonDetailPaneClass(FormSubmitButtonDetailPane.class); DesignModuleFactory.registerButtonDetailPaneClass(FormSubmitButtonDetailPane.class);
DesignModuleFactory.registerParameterReader(new FormParameterReader()); DesignModuleFactory.registerParameterReader(new FormParameterReader());
StableFactory.registerMarkedClass(BaseJForm.XML_TAG, JForm.class); StableFactory.registerMarkedClass(BaseJForm.XML_TAG, JForm.class);
StableFactory.registerMarkedObject(ElementCaseThumbnailProcessor.MARK_STRING, new ElementCaseThumbnail()); StableFactory.registerMarkedObject(ElementCaseThumbnailProcessor.MARK_STRING, new ElementCaseThumbnail());
} }
@Override @Override
public void stop() { public void stop() {
unloadLogAppender(); unloadLogAppender();

Loading…
Cancel
Save