Browse Source

Merge pull request #958 in DESIGN/design from ~VITO/c-design:feature/10.0 to feature/10.0

* commit 'edd6531a5fe0e6710debcd5e1fe3657b806ce0e2':
  REPORT-16346 优化
  无jira任务 import优化
  误传
  误传
  REPORT-16346 alphafine面板创建索引缓存
research/10.0
vito 5 years ago
parent
commit
db96835c2a
  1. 4
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 89
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  3. 9
      designer-base/src/main/java/com/fr/design/constants/DesignerLaunchStatus.java
  4. 3
      designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java
  5. 2
      designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java
  6. 135
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  7. 31
      designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java
  8. 4
      designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java
  9. 1
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java
  10. 16
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java
  11. 3
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  12. 3
      designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java
  13. 3
      designer-chart/src/main/java/com/fr/design/module/FormHyperlinkGroup.java
  14. 5
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java
  15. 10
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoPane.java
  16. 2
      designer-realize/src/main/java/com/fr/design/mainframe/cell/QuickEditorRegion.java
  17. 6
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  18. 15
      designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java
  19. 53
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  20. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java
  21. 31
      designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

4
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -149,7 +149,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/**
* alphafine
*/
private AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance();
private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance();
@ -1514,7 +1514,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
private void readAlphaFineAttr(XMLableReader reader) {
reader.readXMLObject(this.alphaFineConfigManager = new AlphaFineConfigManager());
reader.readXMLObject(this.alphaFineConfigManager = AlphaFineConfigManager.getInstance());
}
private void readHttpsParas(XMLableReader reader) {

89
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -1,19 +1,29 @@
package com.fr.design.actions.help.alphafine;
import com.fr.general.ComparatorUtils;
import com.fr.license.function.VT4FR;
import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* Created by XiaXiang on 2017/4/5.
* AlphaFine配置类
*
* @author XiaXiang
* @date 2017/4/5
*/
public class AlphaFineConfigManager implements XMLable {
private static final long serialVersionUID = -8170289826729582122L;
private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
/**
* 是否开启alphafine
@ -56,12 +66,12 @@ public class AlphaFineConfigManager implements XMLable {
*/
private boolean containPlugin = true;
/**
* 分词搜索
*/
* 分词搜索
*/
private boolean needSegmentationCheckbox = true;
/**
* 智能客服
*/
* 智能客服
*/
private boolean needIntelligentCustomerService = true;
/**
* 快捷键
@ -71,11 +81,18 @@ public class AlphaFineConfigManager implements XMLable {
* 是否提醒
*/
private boolean needRemind = true;
private Map<String, String> actionSearchTextCache = new HashMap<>(8);
private String cacheBuildNO;
/**
* 直接操作菜单次数
*/
private int operateCount;
private AlphaFineConfigManager() {
}
public static AlphaFineConfigManager getInstance() {
return alphaFineConfigManager;
}
@ -87,8 +104,7 @@ public class AlphaFineConfigManager implements XMLable {
@Override
public Object clone() throws CloneNotSupportedException {
AlphaFineConfigManager manager = (AlphaFineConfigManager) super.clone();
return manager;
return super.clone();
}
@Override
@ -107,9 +123,33 @@ public class AlphaFineConfigManager implements XMLable {
this.setShortcuts(reader.getAttrAsString("shortcuts", getDefaultShortCuts()));
this.setNeedRemind(reader.getAttrAsBoolean("isNeedRemind", true));
this.setOperateCount(reader.getAttrAsInt("operateCount", 0));
} else if (reader.isChildNode()) {
if (ComparatorUtils.equals(reader.getTagName(), "ActionSearchTextCache")) {
readActionSearchTextCacheXML(reader);
}
}
}
/**
* 读出搜索缓存
*/
private void readActionSearchTextCacheXML(XMLableReader reader) {
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
if (ComparatorUtils.equals(reader.getTagName(), "ActionSearchTextCache")) {
setCacheBuildNO(reader.getAttrAsString("buildNO", ""));
} else if (ComparatorUtils.equals(reader.getTagName(), "item")) {
String tmpVal = reader.getElementValue();
if (tmpVal != null) {
actionSearchTextCache.put(reader.getAttrAsString("key", ""), tmpVal);
} else {
actionSearchTextCache.put(reader.getAttrAsString("key", ""), StringUtils.EMPTY);
}
}
}
});
}
@Override
@ -128,6 +168,18 @@ public class AlphaFineConfigManager implements XMLable {
.attr("operateCount", this.getOperateCount())
.attr("needSegmentationCheckbox", this.isNeedSegmentationCheckbox())
.attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService());
writeActionSearchTextCacheXML(writer);
writer.end();
}
/**
* 写入搜索缓存
*/
private void writeActionSearchTextCacheXML(XMLPrintWriter writer) {
writer.startTAG("ActionSearchTextCache").attr("buildNO", cacheBuildNO);
for (Map.Entry<String, String> item : actionSearchTextCache.entrySet()) {
writer.startTAG("item").attr("key", item.getKey()).textNode(item.getValue()).end();
}
writer.end();
}
@ -262,4 +314,25 @@ public class AlphaFineConfigManager implements XMLable {
public void setOperateCount(int operateCount) {
this.operateCount = operateCount;
}
@NotNull
public Map<String, String> getActionSearchTextCache() {
return Collections.unmodifiableMap(actionSearchTextCache);
}
public void setActionSearchTextCache(@NotNull String key, @NotNull String value) {
this.actionSearchTextCache.put(key, value);
}
@NotNull
public String getCacheBuildNO() {
if (cacheBuildNO == null) {
return StringUtils.EMPTY;
}
return cacheBuildNO;
}
public void setCacheBuildNO(@NotNull String cacheBuildNO) {
this.cacheBuildNO = cacheBuildNO;
}
}

9
designer-base/src/main/java/com/fr/design/constants/DesignerLaunchStatus.java

@ -19,7 +19,12 @@ public enum DesignerLaunchStatus implements Event<Null> {
/**
* 设计器模块启动完成
*/
DESIGNER_INIT_COMPLETE;
DESIGNER_INIT_COMPLETE,
/**
* 启动完成
*/
OPEN_LAST_FILE_COMPLETE;
private static DesignerLaunchStatus status;
@ -29,6 +34,6 @@ public enum DesignerLaunchStatus implements Event<Null> {
public static void setStatus(DesignerLaunchStatus state) {
status = state;
EventDispatcher.fire(DesignerLaunchStatus.getStatus());
EventDispatcher.asyncFire(DesignerLaunchStatus.getStatus());
}
}

3
designer-base/src/main/java/com/fr/design/gui/frpane/BaseHyperlinkGroup.java

@ -4,6 +4,7 @@ import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.module.DesignModuleFactory;
import com.fr.js.JavaScript;
import com.fr.stable.Filter;
import org.jetbrains.annotations.NotNull;
/**
* 基础的超级链接类型, 不包括图表相关超链.
@ -18,6 +19,8 @@ public class BaseHyperlinkGroup implements HyperlinkGroupType {
*
* @return NameableCreator[]
*/
@NotNull
@Override
public NameableCreator[] getHyperlinkCreators() {
return DesignModuleFactory.getCreators4Hyperlink();
}

2
designer-base/src/main/java/com/fr/design/gui/frpane/HyperlinkGroupType.java

@ -3,6 +3,7 @@ package com.fr.design.gui.frpane;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.js.JavaScript;
import com.fr.stable.Filter;
import org.jetbrains.annotations.NotNull;
/**
* 超级链接 支持的类型 种类.
@ -17,6 +18,7 @@ public interface HyperlinkGroupType {
*
* @return NameableCreator[]
*/
@NotNull
NameableCreator[] getHyperlinkCreators();

135
designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionManager.java

@ -1,29 +1,46 @@
package com.fr.design.mainframe.toolbar;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.gui.frpane.LoadingBasicPane;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.general.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import javax.swing.JPanel;
import javax.swing.*;
import java.util.HashMap;
import java.util.List;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by XiaXiang on 2017/4/13.
* 按钮面板管理类
*
* @author XiaXiang
* @date 2017/4/13
*/
public class UpdateActionManager {
private static UpdateActionManager updateActionManager = null;
private List<UpdateActionModel> updateActions;
private ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
1, 2,
30000L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(),
new ThreadFactoryBuilder().setNameFormat("alphafine-thread-%s").build());//目前测下来一个线程慢慢做处理总共大概也只要两秒,暂时就这样
private Map<String, UpdateAction> updateActionsIndexCache = new HashMap<>(16);
private static boolean isRegisterIndexSearchTextTask = false;
/**
* 限制初始化
*/
private UpdateActionManager() {
}
public synchronized static UpdateActionManager getUpdateActionManager() {
if (updateActionManager == null) {
@ -55,22 +72,92 @@ public class UpdateActionManager {
return null;
}
public synchronized void dealWithSearchText(final String paneClass, final UpdateAction updateAction) {
threadPoolExecutor.allowCoreThreadTimeOut(true);
threadPoolExecutor.execute(new Runnable() {
/**
* 处理action的搜索文本
* 缓存逻辑
* 1.首次索引或缓存失效的时候更新版本会使缓存失效会将索引缓存存到env.xml
* 下次直接加载
* 2.需要重新索引则等待设计器初始化完毕之后单线程运行索引任务
*
* @param paneClass 面板类名
* @param updateAction 待处理的updateAction
*/
public void dealWithSearchText(String paneClass, UpdateAction updateAction) {
Map<String, String> actionSearchTextCache = AlphaFineConfigManager.getInstance().getActionSearchTextCache();
if (!cacheValid()
|| actionSearchTextCache.isEmpty()
|| !actionSearchTextCache.containsKey(paneClass)) {
if (!updateActionsIndexCache.containsKey(paneClass)) {
updateActionsIndexCache.put(paneClass, updateAction);
}
registerIndexSearchTextTask();
} else {
updateAction.setSearchText(actionSearchTextCache.get(paneClass));
}
}
/**
* 缓存是否有效
* 注意开发工程版本为不是安装版本
* 索引只会出现在首次启动
*
* @return true有效false失效
*/
private boolean cacheValid() {
return ComparatorUtils.equals(GeneralUtils.readBuildNO(), AlphaFineConfigManager.getInstance().getCacheBuildNO());
}
/**
* 由于是UI线程不考虑并发问题
*/
private void registerIndexSearchTextTask() {
if (isRegisterIndexSearchTextTask) {
return;
}
isRegisterIndexSearchTextTask = true;
// 没有缓存或者缓存失效的时候,等待设计器启动之后开始索引任务
EventDispatcher.listen(DesignerLaunchStatus.OPEN_LAST_FILE_COMPLETE, new Listener<Null>() {
@Override
public void run() {
JPanel panel = null;
try {
panel = (JPanel) StableUtils.classForName(paneClass).newInstance();
if (panel instanceof LoadingBasicPane) {
panel = ((LoadingBasicPane) panel).getAllComponents();
}
updateAction.setSearchText(updateAction.getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer()));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
public void on(Event event, Null param) {
// 使用单线程索引
ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("IndexAlphaFineSearchText"));
for (Map.Entry<String, UpdateAction> cache : updateActionsIndexCache.entrySet()) {
es.execute(new IndexTask(cache.getKey(), cache.getValue()));
}
updateActionsIndexCache = null;
es.shutdown();
// 标记一下缓存版本
AlphaFineConfigManager.getInstance().setCacheBuildNO(GeneralUtils.readBuildNO());
}
});
}
/**
* 索引任务
*/
class IndexTask implements Runnable {
private String className;
private UpdateAction updateAction;
IndexTask(String className, UpdateAction updateAction) {
this.className = className;
this.updateAction = updateAction;
}
@Override
public void run() {
JPanel panel;
try {
panel = (JPanel) StableUtils.classForName(className).newInstance();
if (panel instanceof LoadingBasicPane) {
panel = ((LoadingBasicPane) panel).getAllComponents();
}
String componentTexts = updateAction.getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer());
updateAction.setSearchText(componentTexts);
AlphaFineConfigManager.getInstance().setActionSearchTextCache(className, componentTexts);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}
}

31
designer-base/src/main/java/com/fr/design/menu/ToolBarDef.java

@ -2,25 +2,27 @@ package com.fr.design.menu;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Define toolbar..
*/
public class ToolBarDef {
public class ToolBarDef {
// item List.
private List<ShortCut> shortcutList = new ArrayList<ShortCut>();
/*
/**
* 一个static的方法生成一个JToolBar
*/
public static UIToolbar createJToolBar(final Color background) {
UIToolbar toolbar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI(){
UIToolbar toolbar = new UIToolbar(FlowLayout.LEFT, new UIToolBarUI() {
@Override
public void paint(Graphics g, JComponent c) {
Graphics2D g2 = (Graphics2D) g;
@ -33,13 +35,13 @@ public class ToolBarDef {
}
/*
/**
* 一个static的方法生成一个JToolBar
*/
public static UIToolbar createJToolBar() {
UIToolbar toolbar = new UIToolbar(FlowLayout.LEFT);
UIToolbar toolbar = new UIToolbar(FlowLayout.LEFT);
toolbar.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0));
return toolbar;
return toolbar;
}
public ToolBarDef() {
@ -49,22 +51,23 @@ public class ToolBarDef {
return this.shortcutList.size();
}
@Nullable
public ShortCut getShortCut(int index) {
return this.shortcutList.get(index);
}
// 用可变参数,方便添加数组
/**
* 用可变参数方便添加数组
*/
public void addShortCut(ShortCut... shortcut) {
for(ShortCut i : shortcut){
this.shortcutList.add(i);
}
Collections.addAll(this.shortcutList, shortcut);
}
public void clearShortCuts() {
this.shortcutList.clear();
}
/*
/**
* 根据当前的ToolBarDef,更新toolBar
*/
public void updateToolBar(UIToolbar toolBar) {
@ -72,8 +75,10 @@ public class ToolBarDef {
int actionCount = this.getShortCutCount();
for (int i = 0; i < actionCount; i++) {
ShortCut shortcut = this.getShortCut(i);
shortcut.intoJToolBar(toolBar);
ShortCut shortcut = this.getShortCut(i);
if (shortcut != null) {
shortcut.intoJToolBar(toolBar);
}
}
}

4
designer-base/src/main/java/com/fr/design/module/DesignModuleFactory.java

@ -16,6 +16,7 @@ import com.fr.design.parameter.ParameterReader;
import com.fr.form.ui.Widget;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils;
import org.jetbrains.annotations.NotNull;
import java.awt.Dialog;
import java.awt.Frame;
@ -65,8 +66,9 @@ public class DesignModuleFactory {
instance.creators4Hyperlink = nameableCreators;
}
@NotNull
public static NameableCreator[] getCreators4Hyperlink() {
return instance.creators4Hyperlink;
return instance.creators4Hyperlink == null? new NameableCreator[0]:instance.creators4Hyperlink;
}
public static void registerExtraWidgetOptions(WidgetOption[] options) {

1
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateDialog.java

@ -37,6 +37,7 @@ class DesignerPushUpdateDialog extends UIDialog {
static void createAndShow(final Frame parent, final DesignerUpdateInfo updateInfo) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
DesignerPushUpdateDialog dialog = new DesignerPushUpdateDialog(parent);
dialog.populate(updateInfo);

16
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java

@ -1,5 +1,6 @@
package com.fr.design.update.push;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame;
@ -13,12 +14,17 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by plough on 2019/4/8.
*/
public class DesignerPushUpdateManager {
private static final String SPLIT_CHAR = "-";
private static DesignerPushUpdateManager singleton;
private final ExecutorService checkUpdateService = Executors.newSingleThreadExecutor(new NamedThreadFactory("DesignerCheckUpdate"));
private final ExecutorService updateService = Executors.newSingleThreadExecutor(new NamedThreadFactory("DesignerUpdate"));
private DesignerUpdateInfo updateInfo;
@ -94,7 +100,7 @@ public class DesignerPushUpdateManager {
* 检查更新如果有合适的更新版本则弹窗
*/
private void checkAndPop() {
new Thread() {
checkUpdateService.execute(new Runnable() {
@Override
public void run() {
if (!shouldPopUp()) {
@ -104,7 +110,8 @@ public class DesignerPushUpdateManager {
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
DesignerPushUpdateDialog.createAndShow(designerFrame, updateInfo);
}
}.start();
});
checkUpdateService.shutdown();
}
private boolean shouldPopUp() {
@ -146,14 +153,15 @@ public class DesignerPushUpdateManager {
* 跳转到更新升级窗口并自动开始更新
*/
void doUpdate() {
new Thread() {
updateService.execute(new Runnable() {
@Override
public void run() {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit();
dialog.showDialog();
}
}.start();
});
updateService.shutdown();
}
/**

3
designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java

@ -4,6 +4,7 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.design.module.ChartEmptyDataStyleAction;
@ -53,6 +54,8 @@ public class ChartDesignerActivator extends Activator implements Prepare {
DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance());
DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE);
ChartTypeInterfaceManager.addPluginChangedListener();
}

3
designer-chart/src/main/java/com/fr/design/module/ChartHyperlinkGroup.java

@ -19,6 +19,7 @@ import com.fr.js.JavaScript;
import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import com.fr.stable.bridge.StableFactory;
import org.jetbrains.annotations.NotNull;
/**
* 图表的超级链接界面. 比一般的HyperlinkGroupPane多了图表的相关超级链接
@ -33,6 +34,8 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
*
* @return NameableCreator[]
*/
@NotNull
@Override
public NameableCreator[] getHyperlinkCreators() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);

3
designer-chart/src/main/java/com/fr/design/module/FormHyperlinkGroup.java

@ -11,6 +11,7 @@ import com.fr.design.gui.frpane.BaseHyperlinkGroup;
import com.fr.js.FormHyperlinkProvider;
import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory;
import org.jetbrains.annotations.NotNull;
/**
* Created with IntelliJ IDEA.
@ -25,6 +26,8 @@ public class FormHyperlinkGroup extends BaseHyperlinkGroup {
*
* @return NameableCreator[]
*/
@NotNull
@Override
public NameableCreator[] getHyperlinkCreators() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
NameableCreator[] related4ChartHyper = {

5
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -526,7 +526,10 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
!ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) {
try {
//旧选中内容编辑器释放模板对象
this.getCurrentEditor().release();
QuickEditor editor = this.getCurrentEditor();
if(editor != null){
editor.release();
}
} catch (UnsupportedOperationException e) {
FineLoggerFactory.getLogger().info("Nothing to release");
}

10
designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoPane.java

@ -4,6 +4,7 @@
package com.fr.design.mainframe.bbs;
import com.fr.base.FRContext;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants;
@ -20,6 +21,8 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
@ -111,7 +114,7 @@ public class UserInfoPane extends BasicPane {
return StringUtils.EMPTY;
}
public void updateBBSUserInfo(){
public void updateBBSUserInfo() {
String username = MarketConfig.getInstance().getBbsUsername();
if (StringUtils.isEmpty(username)) {
markUnSignIn();
@ -149,7 +152,8 @@ public class UserInfoPane extends BasicPane {
}
private void autoPushLoginDialog() {
Thread showBBSThread = new Thread(new Runnable() {
ExecutorService executorService = Executors.newSingleThreadExecutor(new NamedThreadFactory("BBSAutoPushLogin"));
executorService.execute(new Runnable() {
@Override
public void run() {
@ -185,7 +189,7 @@ public class UserInfoPane extends BasicPane {
}
});
showBBSThread.start();
executorService.shutdown();
}

2
designer-realize/src/main/java/com/fr/design/mainframe/cell/QuickEditorRegion.java

@ -46,7 +46,7 @@ public class QuickEditorRegion extends JPanel {
*/
public void populate(final QuickEditor currentEditor) {
this.removeAll();
if (currentEditor.getComponentCount() == 0) {
if (currentEditor == null || currentEditor.getComponentCount() == 0) {
this.add(getEmptyEditor(), BorderLayout.CENTER);
} else {
this.add(currentEditor, BorderLayout.CENTER);

6
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -26,6 +26,7 @@ import com.fr.main.FineBook;
import com.fr.page.PaperSettingProvider;
import com.fr.page.ReportSettingsProvider;
import com.fr.page.WatermarkPainter;
import com.fr.page.stable.PaperSetting;
import com.fr.report.ReportHelper;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
@ -118,7 +119,7 @@ public class GridUI extends ComponentUI {
protected ReportSettingsProvider getReportSettings(ElementCase elementCase) {
if (elementCase instanceof Report) {
return ReportUtils.getReportSettings((Report) elementCase);
} else if(elementCase instanceof FormElementCase){
} else if (elementCase instanceof FormElementCase) {
return ((FormElementCase) elementCase).getReportSettings();
} else {
return new ReportSettings();
@ -141,6 +142,9 @@ public class GridUI extends ComponentUI {
// richer;聚合报表设计中,最初的ElementCase还没有加到Report中,所以elementCase.getReport()可能为空
ReportSettingsProvider reportSettings = getReportSettings(elementCase);
PaperSettingProvider psetting = reportSettings.getPaperSetting();
if (psetting == null) {
psetting = new PaperSetting();
}
if (grid.getPaginateLineShowType() != Grid.NO_PAGINATE_LINE) {// paint paper margin line.
PaperSize paperSize = psetting.getPaperSize();
Margin margin = psetting.getMargin();

15
designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java

@ -1,5 +1,6 @@
package com.fr.start.fx;
import com.fr.concurrent.NamedThreadFactory;
import com.sun.javafx.iio.ImageFrame;
import com.sun.javafx.iio.ImageLoadListener;
import com.sun.javafx.iio.ImageLoader;
@ -14,6 +15,8 @@ import com.sun.prism.impl.PrismSettings;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* 边加载边播放的gif加载器
@ -36,7 +39,8 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader {
delayTimes = new int[gifCount];
this.width = width;
this.height = height;
new Thread() {
ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("PrismImageLoader2"));
es.execute(new Runnable() {
@Override
public void run() {
InputStream inputStream = null;
@ -47,14 +51,16 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader {
e.printStackTrace();
} finally {
try {
inputStream.close();
if (inputStream != null) {
inputStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}.start();
});
es.shutdown();
}
@Override
@ -108,6 +114,7 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader {
return 40;
}
@Override
public int getLoopCount() {
return 0;
}

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

@ -5,7 +5,6 @@ import com.fr.base.Formula;
import com.fr.base.MultiFieldParameter;
import com.fr.base.process.ProcessOperator;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.NewFormAction;
import com.fr.design.actions.core.ActionFactory;
@ -22,7 +21,6 @@ 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.bridge.DesignToolbarProvider;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.fun.ElementUIProvider;
import com.fr.design.gui.controlpane.NameObjectCreator;
@ -35,9 +33,6 @@ import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.javascript.ProcessTransitionAdapter;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.ElementCaseThumbnail;
import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.InformationCollector;
@ -51,7 +46,6 @@ 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.loghandler.DesignerLogAppender;
import com.fr.design.mainframe.loghandler.LogMessageBar;
import com.fr.design.mainframe.socketio.DesignerSocketIO;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.FormParameterReader;
@ -59,7 +53,6 @@ import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.design.parameter.WorkBookParameterReader;
import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane;
import com.fr.form.stable.ElementCaseThumbnailProcessor;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.js.EmailJavaScript;
import com.fr.js.JavaScriptImpl;
@ -105,8 +98,6 @@ import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by juhaoyu on 2018/1/31.
@ -126,7 +117,6 @@ public class DesignerActivator extends Activator {
}
}
designerModuleStart();
preLoadPane();
loadLogAppender();
DesignerSocketIO.update();
UserInfoPane.getInstance().updateBBSUserInfo();
@ -169,49 +159,6 @@ public class DesignerActivator extends Activator {
InformationCollector.getInstance().collectStartTime();
}
private static void preLoadPane() {
ExecutorService service = Executors.newCachedThreadPool(new NamedThreadFactory("PreLoadPane"));
service.submit(new Runnable() {
@Override
public void run() {
LogMessageBar.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
HistoryTemplateListPane.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
WidgetInfoConfig.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
CellElementPropertyPane.getInstance();
}
});
service.submit(new Runnable() {
@Override
public void run() {
DesignerFrameFileDealerPane.getInstance();//这边会涉及到TemplateTreePane
}
});
service.submit(new Runnable() {
@Override
public void run() {
EastRegionContainerPane.getInstance();
}
});
service.shutdown();
}
private static Class<?>[] actionsForInsertCellElement() {
List<Class<?>> classes = new ArrayList<>();
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);

4
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

@ -2,6 +2,7 @@ package com.fr.start.module;
import com.fr.design.DesignerEnvManager;
import com.fr.design.EnvChangeEntrance;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.log.FineLoggerFactory;
@ -39,13 +40,12 @@ public class DesignerWorkspaceProvider extends Activator {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner();
}
}
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE);
}
@Override
public void stop() {
}
}

31
designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java

@ -1,11 +1,9 @@
package com.fr.start.module;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.RestartHelper;
import com.fr.design.fun.OemProcessor;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.template.info.TemplateInfoCollector;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignerPort;
import com.fr.event.EventDispatcher;
@ -24,11 +22,8 @@ import com.fr.start.SplashContext;
import com.fr.start.SplashStrategy;
import com.fr.start.fx.SplashFx;
import com.fr.start.jni.SplashMac;
import com.fr.start.preload.ImagePreLoader;
import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Created by juhaoyu on 2018/1/8.
@ -52,8 +47,6 @@ public class PreStartActivator extends Activator {
RestartHelper.deleteRecordFilesWhenStart();
preloadResource();
SplashContext.getInstance().registerSplash(createSplash());
SplashContext.getInstance().show();
@ -115,30 +108,6 @@ public class PreStartActivator extends Activator {
return new String[]{".cpt", ".xls", ".xlsx", ".frm", ".form", ".cht", ".chart"};
}
private static void preloadResource() {
ExecutorService service = Executors.newCachedThreadPool(new NamedThreadFactory("PreLoadResource"));
service.submit(new Runnable() {
@Override
public void run() {
new ImagePreLoader();
}
});
service.submit(new Runnable() {
@Override
public void run() {
TemplateInfoCollector.getInstance();
}
});
service.shutdown();
}
private SplashStrategy createSplash() {
OemProcessor oemProcessor = OemHandler.findOem();

Loading…
Cancel
Save