Browse Source

REPORT-16346 alphafine面板创建索引缓存

research/10.0
vito 5 years ago
parent
commit
86632c7309
  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. 34
      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. 19
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  18. 13
      designer-realize/src/main/java/com/fr/start/fx/PrismImageLoader2.java
  19. 5
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  20. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

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

@ -146,7 +146,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();
@ -1510,7 +1510,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;
}
} }

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

@ -0,0 +1,34 @@
package com.fr.design.constants;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Null;
/**
* 设计器启动事件类型
*
* @author vito
* @date 2019-06-18
*/
public enum DesignerLaunchStatus implements Event<Null> {
/**
* 初始化环境完成
*/
WORKSPACE_INIT_COMPLETE,
/**
* 设计器模块启动完成
*/
DESIGNER_INIT_COMPLETE;
private static DesignerLaunchStatus status;
public static DesignerLaunchStatus getStatus() {
return status;
}
public static void setStatus(DesignerLaunchStatus state) {
status = state;
EventDispatcher.fire(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.DESIGNER_INIT_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);

19
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;
@ -48,20 +49,9 @@ import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.third.antlr.ANTLRException; import com.fr.third.antlr.ANTLRException;
import javax.swing.JComponent; import javax.swing.*;
import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI; import javax.swing.plaf.ComponentUI;
import java.awt.AlphaComposite; import java.awt.*;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Composite;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Paint;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.GeneralPath; import java.awt.geom.GeneralPath;
import java.awt.geom.Line2D; import java.awt.geom.Line2D;
@ -141,6 +131,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;
} }

5
designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java

@ -16,12 +16,13 @@ public class DesignerStartup extends Activator {
@Override @Override
@Metrics @Metrics
public void start() { public void start() {
startSub(PreStartActivator.class); startSub(PreStartActivator.class);
// startSub(DesignerInitActivator.class);
// startSub(DesignerShowActivator.class);
getSub("parallel").start(); getSub("parallel").start();
//designer模块启动好后,查看demo //designer模块启动好后,查看demo
browserDemo(); browserDemo();
startSub(DesignerShowActivator.class);
startSub(StartFinishActivator.class); startSub(StartFinishActivator.class);
FineRuntime.startFinish(); FineRuntime.startFinish();
} }

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

Loading…
Cancel
Save