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. 79
      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. 123
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/UpdateActionManager.java
  7. 19
      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. 8
      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. 4
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  18. 13
      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 * alphafine
*/ */
private AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager(); private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance();
private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance(); private DesignerPushUpdateConfigManager designerPushUpdateConfigManager = DesignerPushUpdateConfigManager.getInstance();
@ -1514,7 +1514,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
} }
private void readAlphaFineAttr(XMLableReader reader) { private void readAlphaFineAttr(XMLableReader reader) {
reader.readXMLObject(this.alphaFineConfigManager = new AlphaFineConfigManager()); reader.readXMLObject(this.alphaFineConfigManager = AlphaFineConfigManager.getInstance());
} }
private void readHttpsParas(XMLableReader reader) { private void readHttpsParas(XMLableReader reader) {

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

@ -1,19 +1,29 @@
package com.fr.design.actions.help.alphafine; package com.fr.design.actions.help.alphafine;
import com.fr.general.ComparatorUtils;
import com.fr.license.function.VT4FR; import com.fr.license.function.VT4FR;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLReadable;
import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import org.jetbrains.annotations.NotNull;
import javax.swing.*; 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 { public class AlphaFineConfigManager implements XMLable {
private static final long serialVersionUID = -8170289826729582122L;
private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager(); private static AlphaFineConfigManager alphaFineConfigManager = new AlphaFineConfigManager();
/** /**
* 是否开启alphafine * 是否开启alphafine
@ -71,11 +81,18 @@ public class AlphaFineConfigManager implements XMLable {
* 是否提醒 * 是否提醒
*/ */
private boolean needRemind = true; private boolean needRemind = true;
private Map<String, String> actionSearchTextCache = new HashMap<>(8);
private String cacheBuildNO;
/** /**
* 直接操作菜单次数 * 直接操作菜单次数
*/ */
private int operateCount; private int operateCount;
private AlphaFineConfigManager() {
}
public static AlphaFineConfigManager getInstance() { public static AlphaFineConfigManager getInstance() {
return alphaFineConfigManager; return alphaFineConfigManager;
} }
@ -87,8 +104,7 @@ public class AlphaFineConfigManager implements XMLable {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
AlphaFineConfigManager manager = (AlphaFineConfigManager) super.clone(); return super.clone();
return manager;
} }
@Override @Override
@ -107,10 +123,34 @@ public class AlphaFineConfigManager implements XMLable {
this.setShortcuts(reader.getAttrAsString("shortcuts", getDefaultShortCuts())); this.setShortcuts(reader.getAttrAsString("shortcuts", getDefaultShortCuts()));
this.setNeedRemind(reader.getAttrAsBoolean("isNeedRemind", true)); this.setNeedRemind(reader.getAttrAsBoolean("isNeedRemind", true));
this.setOperateCount(reader.getAttrAsInt("operateCount", 0)); 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 @Override
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
@ -128,6 +168,18 @@ public class AlphaFineConfigManager implements XMLable {
.attr("operateCount", this.getOperateCount()) .attr("operateCount", this.getOperateCount())
.attr("needSegmentationCheckbox", this.isNeedSegmentationCheckbox()) .attr("needSegmentationCheckbox", this.isNeedSegmentationCheckbox())
.attr("needIntelligentCustomerService", this.isNeedIntelligentCustomerService()); .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(); writer.end();
} }
@ -262,4 +314,25 @@ public class AlphaFineConfigManager implements XMLable {
public void setOperateCount(int operateCount) { public void setOperateCount(int operateCount) {
this.operateCount = 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; private static DesignerLaunchStatus status;
@ -29,6 +34,6 @@ public enum DesignerLaunchStatus implements Event<Null> {
public static void setStatus(DesignerLaunchStatus state) { public static void setStatus(DesignerLaunchStatus state) {
status = 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.design.module.DesignModuleFactory;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.stable.Filter; import com.fr.stable.Filter;
import org.jetbrains.annotations.NotNull;
/** /**
* 基础的超级链接类型, 不包括图表相关超链. * 基础的超级链接类型, 不包括图表相关超链.
@ -18,6 +19,8 @@ public class BaseHyperlinkGroup implements HyperlinkGroupType {
* *
* @return NameableCreator[] * @return NameableCreator[]
*/ */
@NotNull
@Override
public NameableCreator[] getHyperlinkCreators() { public NameableCreator[] getHyperlinkCreators() {
return DesignModuleFactory.getCreators4Hyperlink(); 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.design.gui.controlpane.NameableCreator;
import com.fr.js.JavaScript; import com.fr.js.JavaScript;
import com.fr.stable.Filter; import com.fr.stable.Filter;
import org.jetbrains.annotations.NotNull;
/** /**
* 超级链接 支持的类型 种类. * 超级链接 支持的类型 种类.
@ -17,6 +18,7 @@ public interface HyperlinkGroupType {
* *
* @return NameableCreator[] * @return NameableCreator[]
*/ */
@NotNull
NameableCreator[] getHyperlinkCreators(); NameableCreator[] getHyperlinkCreators();

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

@ -1,29 +1,46 @@
package com.fr.design.mainframe.toolbar; package com.fr.design.mainframe.toolbar;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.actions.UpdateAction; 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.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.ComparatorUtils;
import com.fr.general.GeneralUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import javax.swing.JPanel; import javax.swing.*;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.LinkedBlockingQueue; import java.util.Map;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit; import java.util.concurrent.Executors;
/** /**
* Created by XiaXiang on 2017/4/13. * 按钮面板管理类
*
* @author XiaXiang
* @date 2017/4/13
*/ */
public class UpdateActionManager { public class UpdateActionManager {
private static UpdateActionManager updateActionManager = null; private static UpdateActionManager updateActionManager = null;
private List<UpdateActionModel> updateActions; private List<UpdateActionModel> updateActions;
private ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
1, 2, private Map<String, UpdateAction> updateActionsIndexCache = new HashMap<>(16);
30000L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>(), private static boolean isRegisterIndexSearchTextTask = false;
new ThreadFactoryBuilder().setNameFormat("alphafine-thread-%s").build());//目前测下来一个线程慢慢做处理总共大概也只要两秒,暂时就这样
/**
* 限制初始化
*/
private UpdateActionManager() {
}
public synchronized static UpdateActionManager getUpdateActionManager() { public synchronized static UpdateActionManager getUpdateActionManager() {
if (updateActionManager == null) { if (updateActionManager == null) {
@ -55,22 +72,92 @@ public class UpdateActionManager {
return null; return null;
} }
public synchronized void dealWithSearchText(final String paneClass, final UpdateAction updateAction) { /**
threadPoolExecutor.allowCoreThreadTimeOut(true); * 处理action的搜索文本
threadPoolExecutor.execute(new Runnable() { * 缓存逻辑
* 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 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 @Override
public void run() { public void run() {
JPanel panel = null; JPanel panel;
try { try {
panel = (JPanel) StableUtils.classForName(paneClass).newInstance(); panel = (JPanel) StableUtils.classForName(className).newInstance();
if (panel instanceof LoadingBasicPane) { if (panel instanceof LoadingBasicPane) {
panel = ((LoadingBasicPane) panel).getAllComponents(); panel = ((LoadingBasicPane) panel).getAllComponents();
} }
updateAction.setSearchText(updateAction.getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer())); String componentTexts = updateAction.getComponentTexts(panel, "_", new StringBuffer(), new StringBuffer(), new StringBuffer());
updateAction.setSearchText(componentTexts);
AlphaFineConfigManager.getInstance().setActionSearchTextCache(className, componentTexts);
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e); FineLoggerFactory.getLogger().error(e.getMessage(), e);
} }
} }
});
} }
} }

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

@ -2,10 +2,12 @@ package com.fr.design.menu;
import com.fr.design.gui.itoolbar.UIToolBarUI; import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itoolbar.UIToolbar;
import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -16,7 +18,7 @@ public class ToolBarDef {
// item List. // item List.
private List<ShortCut> shortcutList = new ArrayList<ShortCut>(); private List<ShortCut> shortcutList = new ArrayList<ShortCut>();
/* /**
* 一个static的方法生成一个JToolBar * 一个static的方法生成一个JToolBar
*/ */
public static UIToolbar createJToolBar(final Color background) { public static UIToolbar createJToolBar(final Color background) {
@ -33,7 +35,7 @@ public class ToolBarDef {
} }
/* /**
* 一个static的方法生成一个JToolBar * 一个static的方法生成一个JToolBar
*/ */
public static UIToolbar createJToolBar() { public static UIToolbar createJToolBar() {
@ -49,22 +51,23 @@ public class ToolBarDef {
return this.shortcutList.size(); return this.shortcutList.size();
} }
@Nullable
public ShortCut getShortCut(int index) { public ShortCut getShortCut(int index) {
return this.shortcutList.get(index); return this.shortcutList.get(index);
} }
// 用可变参数,方便添加数组 /**
* 用可变参数方便添加数组
*/
public void addShortCut(ShortCut... shortcut) { public void addShortCut(ShortCut... shortcut) {
for(ShortCut i : shortcut){ Collections.addAll(this.shortcutList, shortcut);
this.shortcutList.add(i);
}
} }
public void clearShortCuts() { public void clearShortCuts() {
this.shortcutList.clear(); this.shortcutList.clear();
} }
/* /**
* 根据当前的ToolBarDef,更新toolBar * 根据当前的ToolBarDef,更新toolBar
*/ */
public void updateToolBar(UIToolbar toolBar) { public void updateToolBar(UIToolbar toolBar) {
@ -73,8 +76,10 @@ public class ToolBarDef {
int actionCount = this.getShortCutCount(); int actionCount = this.getShortCutCount();
for (int i = 0; i < actionCount; i++) { for (int i = 0; i < actionCount; i++) {
ShortCut shortcut = this.getShortCut(i); ShortCut shortcut = this.getShortCut(i);
if (shortcut != null) {
shortcut.intoJToolBar(toolBar); 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.form.ui.Widget;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import org.jetbrains.annotations.NotNull;
import java.awt.Dialog; import java.awt.Dialog;
import java.awt.Frame; import java.awt.Frame;
@ -65,8 +66,9 @@ public class DesignModuleFactory {
instance.creators4Hyperlink = nameableCreators; instance.creators4Hyperlink = nameableCreators;
} }
@NotNull
public static NameableCreator[] getCreators4Hyperlink() { public static NameableCreator[] getCreators4Hyperlink() {
return instance.creators4Hyperlink; return instance.creators4Hyperlink == null? new NameableCreator[0]:instance.creators4Hyperlink;
} }
public static void registerExtraWidgetOptions(WidgetOption[] options) { 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) { static void createAndShow(final Frame parent, final DesignerUpdateInfo updateInfo) {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() { public void run() {
DesignerPushUpdateDialog dialog = new DesignerPushUpdateDialog(parent); DesignerPushUpdateDialog dialog = new DesignerPushUpdateDialog(parent);
dialog.populate(updateInfo); 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; package com.fr.design.update.push;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DesignerFrame;
@ -13,12 +14,17 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* Created by plough on 2019/4/8. * Created by plough on 2019/4/8.
*/ */
public class DesignerPushUpdateManager { public class DesignerPushUpdateManager {
private static final String SPLIT_CHAR = "-"; private static final String SPLIT_CHAR = "-";
private static DesignerPushUpdateManager singleton; 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; private DesignerUpdateInfo updateInfo;
@ -94,7 +100,7 @@ public class DesignerPushUpdateManager {
* 检查更新如果有合适的更新版本则弹窗 * 检查更新如果有合适的更新版本则弹窗
*/ */
private void checkAndPop() { private void checkAndPop() {
new Thread() { checkUpdateService.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
if (!shouldPopUp()) { if (!shouldPopUp()) {
@ -104,7 +110,8 @@ public class DesignerPushUpdateManager {
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
DesignerPushUpdateDialog.createAndShow(designerFrame, updateInfo); DesignerPushUpdateDialog.createAndShow(designerFrame, updateInfo);
} }
}.start(); });
checkUpdateService.shutdown();
} }
private boolean shouldPopUp() { private boolean shouldPopUp() {
@ -146,14 +153,15 @@ public class DesignerPushUpdateManager {
* 跳转到更新升级窗口并自动开始更新 * 跳转到更新升级窗口并自动开始更新
*/ */
void doUpdate() { void doUpdate() {
new Thread() { updateService.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame()); UpdateMainDialog dialog = new UpdateMainDialog(DesignerContext.getDesignerFrame());
dialog.setAutoUpdateAfterInit(); dialog.setAutoUpdateAfterInit();
dialog.showDialog(); 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.ChartTypeInterfaceManager;
import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.core.ActionFactory;
import com.fr.design.chart.gui.ChartComponent; import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ChartPropertyPane; import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.design.module.ChartEmptyDataStyleAction; import com.fr.design.module.ChartEmptyDataStyleAction;
@ -53,6 +54,8 @@ public class ChartDesignerActivator extends Activator implements Prepare {
DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance()); DesignImageEvent.registerDefaultCallbackEvent(HistoryTemplateListPane.getInstance());
DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); DesignImageEvent.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.DESIGNER_INIT_COMPLETE);
ChartTypeInterfaceManager.addPluginChangedListener(); 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.ArrayUtils;
import com.fr.stable.Filter; import com.fr.stable.Filter;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import org.jetbrains.annotations.NotNull;
/** /**
* 图表的超级链接界面. 比一般的HyperlinkGroupPane多了图表的相关超级链接 * 图表的超级链接界面. 比一般的HyperlinkGroupPane多了图表的相关超级链接
@ -33,6 +34,8 @@ public class ChartHyperlinkGroup extends BaseHyperlinkGroup {
* *
* @return NameableCreator[] * @return NameableCreator[]
*/ */
@NotNull
@Override
public NameableCreator[] getHyperlinkCreators() { public NameableCreator[] getHyperlinkCreators() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); 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.js.FormHyperlinkProvider;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import org.jetbrains.annotations.NotNull;
/** /**
* Created with IntelliJ IDEA. * Created with IntelliJ IDEA.
@ -25,6 +26,8 @@ public class FormHyperlinkGroup extends BaseHyperlinkGroup {
* *
* @return NameableCreator[] * @return NameableCreator[]
*/ */
@NotNull
@Override
public NameableCreator[] getHyperlinkCreators() { public NameableCreator[] getHyperlinkCreators() {
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class); FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
NameableCreator[] related4ChartHyper = { 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())) { !ComparatorUtils.equals(EastRegionContainerPane.getInstance().getCellAttrPane(), CellElementPropertyPane.getInstance())) {
try { try {
//旧选中内容编辑器释放模板对象 //旧选中内容编辑器释放模板对象
this.getCurrentEditor().release(); QuickEditor editor = this.getCurrentEditor();
if(editor != null){
editor.release();
}
} catch (UnsupportedOperationException e) { } catch (UnsupportedOperationException e) {
FineLoggerFactory.getLogger().info("Nothing to release"); FineLoggerFactory.getLogger().info("Nothing to release");
} }

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

@ -4,6 +4,7 @@
package com.fr.design.mainframe.bbs; package com.fr.design.mainframe.bbs;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.config.MarketConfig; import com.fr.config.MarketConfig;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -20,6 +21,8 @@ import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
@ -149,7 +152,8 @@ public class UserInfoPane extends BasicPane {
} }
private void autoPushLoginDialog() { private void autoPushLoginDialog() {
Thread showBBSThread = new Thread(new Runnable() { ExecutorService executorService = Executors.newSingleThreadExecutor(new NamedThreadFactory("BBSAutoPushLogin"));
executorService.execute(new Runnable() {
@Override @Override
public void run() { 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) { public void populate(final QuickEditor currentEditor) {
this.removeAll(); this.removeAll();
if (currentEditor.getComponentCount() == 0) { if (currentEditor == null || currentEditor.getComponentCount() == 0) {
this.add(getEmptyEditor(), BorderLayout.CENTER); this.add(getEmptyEditor(), BorderLayout.CENTER);
} else { } else {
this.add(currentEditor, BorderLayout.CENTER); this.add(currentEditor, BorderLayout.CENTER);

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

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

@ -1,5 +1,6 @@
package com.fr.start.fx; package com.fr.start.fx;
import com.fr.concurrent.NamedThreadFactory;
import com.sun.javafx.iio.ImageFrame; import com.sun.javafx.iio.ImageFrame;
import com.sun.javafx.iio.ImageLoadListener; import com.sun.javafx.iio.ImageLoadListener;
import com.sun.javafx.iio.ImageLoader; import com.sun.javafx.iio.ImageLoader;
@ -14,6 +15,8 @@ import com.sun.prism.impl.PrismSettings;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* 边加载边播放的gif加载器 * 边加载边播放的gif加载器
@ -36,7 +39,8 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader {
delayTimes = new int[gifCount]; delayTimes = new int[gifCount];
this.width = width; this.width = width;
this.height = height; this.height = height;
new Thread() { ExecutorService es = Executors.newSingleThreadExecutor(new NamedThreadFactory("PrismImageLoader2"));
es.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
InputStream inputStream = null; InputStream inputStream = null;
@ -47,14 +51,16 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
try { try {
if (inputStream != null) {
inputStream.close(); inputStream.close();
}
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} }
}.start(); });
es.shutdown();
} }
@Override @Override
@ -108,6 +114,7 @@ class PrismImageLoader2 implements com.sun.javafx.tk.ImageLoader {
return 40; return 40;
} }
@Override
public int getLoopCount() { public int getLoopCount() {
return 0; 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.MultiFieldParameter;
import com.fr.base.process.ProcessOperator; import com.fr.base.process.ProcessOperator;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.actions.NewFormAction; import com.fr.design.actions.NewFormAction;
import com.fr.design.actions.core.ActionFactory; 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.ImageFloatAction;
import com.fr.design.actions.insert.flot.TextBoxFloatAction; import com.fr.design.actions.insert.flot.TextBoxFloatAction;
import com.fr.design.bridge.DesignToolbarProvider; import com.fr.design.bridge.DesignToolbarProvider;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.form.parameter.FormParaDesigner; import com.fr.design.form.parameter.FormParaDesigner;
import com.fr.design.fun.ElementUIProvider; import com.fr.design.fun.ElementUIProvider;
import com.fr.design.gui.controlpane.NameObjectCreator; 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.ParameterJavaScriptPane;
import com.fr.design.javascript.ProcessTransitionAdapter; import com.fr.design.javascript.ProcessTransitionAdapter;
import com.fr.design.mainframe.BaseJForm; 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.ElementCaseThumbnail;
import com.fr.design.mainframe.FormHierarchyTreePane; import com.fr.design.mainframe.FormHierarchyTreePane;
import com.fr.design.mainframe.InformationCollector; 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.FormElementCaseDesigner;
import com.fr.design.mainframe.form.FormReportComponentComposite; 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.socketio.DesignerSocketIO; import com.fr.design.mainframe.socketio.DesignerSocketIO;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.parameter.FormParameterReader; 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.parameter.WorkBookParameterReader;
import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane; import com.fr.design.widget.ui.btn.FormSubmitButtonDetailPane;
import com.fr.form.stable.ElementCaseThumbnailProcessor; import com.fr.form.stable.ElementCaseThumbnailProcessor;
import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.xml.GeneralXMLTools; import com.fr.general.xml.GeneralXMLTools;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
import com.fr.js.JavaScriptImpl; import com.fr.js.JavaScriptImpl;
@ -105,8 +98,6 @@ import java.awt.image.BufferedImage;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/** /**
* Created by juhaoyu on 2018/1/31. * Created by juhaoyu on 2018/1/31.
@ -126,7 +117,6 @@ public class DesignerActivator extends Activator {
} }
} }
designerModuleStart(); designerModuleStart();
preLoadPane();
loadLogAppender(); loadLogAppender();
DesignerSocketIO.update(); DesignerSocketIO.update();
UserInfoPane.getInstance().updateBBSUserInfo(); UserInfoPane.getInstance().updateBBSUserInfo();
@ -169,49 +159,6 @@ public class DesignerActivator extends Activator {
InformationCollector.getInstance().collectStartTime(); 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() { 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);

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.DesignerEnvManager;
import com.fr.design.EnvChangeEntrance; import com.fr.design.EnvChangeEntrance;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.env.DesignerWorkspaceGenerator; import com.fr.design.env.DesignerWorkspaceGenerator;
import com.fr.design.env.DesignerWorkspaceInfo; import com.fr.design.env.DesignerWorkspaceInfo;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -39,13 +40,12 @@ public class DesignerWorkspaceProvider extends Activator {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(); EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner();
} }
} }
DesignerLaunchStatus.setStatus(DesignerLaunchStatus.WORKSPACE_INIT_COMPLETE);
} }
@Override @Override
public void stop() { public void stop() {
} }
} }

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

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

Loading…
Cancel
Save