Browse Source

Merge pull request #10834 in DESIGN/design from release/11.0 to final/11.0

* commit '5e5b339a569712a9645e1e77b3b9900df73d4640': (50 commits)
  REPORT-84965 插件-插件管理-插件id里有下划线,安装之后无法删除 【问题原因】后端解析'_'时,仅考虑有一个'_' 【改动思路】使用最后出现的'_'分隔id和version 【review建议】无
  REPORT-85960 起始页,点击最近打开的fvs模板,模板打开失败--更改一下工具类
  REPORT-86023 起始页先进入本地目录,再进入次管远程目录,会有服务器选项 默认是不会刷新工具栏的。这里刷新一下。 (吐槽一下:权限管理有点太散了
  REPORT-85960 起始页,点击最近打开的fvs模板,模板打开失败
  REPORT-85960 起始页,点击最近打开的fvs模板,模板打开失败 模板助手打开模板时会获取 path, 如果当前是使用空页面打开,则会 npe, 在主JAR兼容一下
  REPORT-85774 sqlserver死锁
  REPORT-85902 fix:字段名数据面板多了下拉栏
  REPORT-85880 数据表现与处理-公式-公式编辑区域显示不正常
  REPORT-85880 数据表现与处理-公式-公式编辑区域显示不正常
  nojira fvs plugin 打包报错
  REPORT-85600修复一下错误的名称 顺带着改个名字,看着难受
  REPORT-85293【启动优化】起始页新增加载进度条视觉效果确认 全屏效果在 windows 上需要处理一下。
  REPORT-75091 && REPORT-80693 数据脱敏一期&二期 【问题原因】迭代延期,屏蔽功能入口 【改动思路】同上 【review建议】
  REPORT-85293【启动优化】起始页新增加载进度条视觉效果确认 ProgressDialog 用错了,这个只能是使用的时候才创建 不然大小有问题
  REPORT-84427 【查找与替换】切换查找内容会出现无法定位的情况(特殊场景)
  REPORT-85210 && REPORT-85293 1-加载条样式优化 2-启动异常报错优化 3-给异步加载 envmanager 提供配置
  REPORT-84428 设置像&模板内容频繁切换会出现空白或全选的异常情况
  fix:格式化
  REPORT-84617 模板认证卡慢更新迭代
  fix: REPORT-83197【设计器】启动页性能优化 处理一部分问题
  ...
new-design
superman 2 years ago
parent
commit
e689c3c843
  1. 319
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 30
      designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java
  3. 8
      designer-base/src/main/java/com/fr/design/actions/file/CloseCurrentTemplateAction.java
  4. 5
      designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java
  5. 3
      designer-base/src/main/java/com/fr/design/carton/EventDispatchThreadHangMonitor.java
  6. 6
      designer-base/src/main/java/com/fr/design/data/StrategyConfigAttrUtils.java
  7. 11
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  8. 355
      designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java
  9. 120
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java
  10. 7
      designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java
  11. 11
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  12. 18
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  13. 1243
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  14. 1238
      designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java
  15. 7
      designer-base/src/main/java/com/fr/design/formula/FormulaPane.java
  16. 9
      designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java
  17. 4
      designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java
  18. 9
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  19. 2
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java
  20. 3
      designer-base/src/main/java/com/fr/design/gui/style/ComponentTitleStylePane.java
  21. 3
      designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java
  22. 8
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java
  23. 4
      designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java
  24. 4
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  25. 10
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  26. 10
      designer-base/src/main/java/com/fr/design/mainframe/JNullTemplate.java
  27. 2
      designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java
  28. 5
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java
  29. 46
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/topparam/MobileTopParamPane.java
  30. 3
      designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/FontConfigPane.java
  31. 3
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartFontPane.java
  32. 8
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java
  33. 8
      designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java
  34. 3
      designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java
  35. 3
      designer-base/src/main/java/com/fr/design/style/FontFamilyPane.java
  36. 13
      designer-base/src/main/java/com/fr/design/utils/DesignUtils.java
  37. 4
      designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java
  38. 8
      designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java
  39. 9
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  40. 4
      designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java
  41. 21
      designer-base/src/main/java/com/fr/start/common/DesignerStartupPool.java
  42. 118
      designer-base/src/main/java/com/fr/startup/ui/StartupLoadingPanel.java
  43. 146
      designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java
  44. 55
      designer-base/src/test/java/com/fr/design/gui/iprogressbar/ProgressDialogTest.java
  45. 3
      designer-chart/src/main/java/com/fr/design/chart/axis/ChartAlertValuePane.java
  46. 3
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/DataLabelStylePane.java
  47. 7
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java
  48. 10
      designer-chart/src/main/java/com/fr/design/chartx/component/correlation/AbstractCorrelationPane.java
  49. 5
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java
  50. 10
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java
  51. 3
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java
  52. 8
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java
  53. 3
      designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java
  54. 11
      designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotTableDataContentPane.java
  55. 3
      designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java
  56. 4
      designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java
  57. 3
      designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutBorderPane.java
  58. 3
      designer-form/src/main/java/com/fr/design/gui/xpane/LayoutBorderPane.java
  59. 4
      designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java
  60. 3
      designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java
  61. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java
  62. 33
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java
  63. 13
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java
  64. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java
  65. 14
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java
  66. 3
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java
  67. 7
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  68. 2
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  69. 9
      designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java
  70. 37
      designer-realize/src/main/java/com/fr/start/MainDesigner.java
  71. 37
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  72. 2
      designer-realize/src/main/java/com/fr/start/module/DesignerStartup.java
  73. 56
      designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java
  74. 36
      designer-realize/src/main/java/com/fr/start/preload/PreLoadService.java

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

@ -4,7 +4,9 @@
package com.fr.design;
import com.fr.base.BaseXMLUtils;
import com.fr.base.OptimizeUtil;
import com.fr.base.Utils;
import com.fr.collections.api.Callback;
import com.fr.design.actions.help.alphafine.AlphaFineConfigManager;
import com.fr.design.carton.SwitchForSwingChecker;
import com.fr.design.constants.UIConstants;
@ -21,8 +23,8 @@ import com.fr.design.locale.impl.ProductImproveMark;
import com.fr.design.login.DesignerLoginType;
import com.fr.design.login.config.DesignerLoginConfigManager;
import com.fr.design.mainframe.ComponentReuseNotifyUtil;
import com.fr.design.mainframe.simple.SimpleDesignerConfig;
import com.fr.design.mainframe.reuse.ComponentReuseNotificationInfo;
import com.fr.design.mainframe.simple.SimpleDesignerConfig;
import com.fr.design.mainframe.vcs.VcsConfigManager;
import com.fr.design.notification.SnapChatConfig;
import com.fr.design.os.impl.SupportOSImpl;
@ -41,6 +43,12 @@ import com.fr.general.SupportLocale;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.general.xml.async.AsyncXmlElement;
import com.fr.general.xml.async.AsyncXmlReadable;
import com.fr.general.xml.async.SimpleXmlElement;
import com.fr.general.xml.async.XmlElement;
import com.fr.general.xml.async.XmlException;
import com.fr.general.xml.async.XmlInitialFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.log.LogHandler;
import com.fr.stable.CommonUtils;
@ -58,8 +66,10 @@ import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.start.common.DesignerStartupConfig;
import com.fr.start.common.DesignerStartupPool;
import com.fr.third.apache.logging.log4j.core.appender.FileAppender;
import com.fr.third.apache.logging.log4j.core.layout.PatternLayout;
import com.fr.third.org.apache.commons.io.FileUtils;
import com.fr.third.org.apache.commons.io.FilenameUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.WorkContextCallback;
@ -86,11 +96,17 @@ import java.util.ListIterator;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* The manager of Designer GUI.
* 下面的作者日期都是随手写的具体作者已经无法考究
*
* @author anonymous
* @version 11.0
* created by anonymous on 2002/11/08
*/
public class DesignerEnvManager implements XMLReadable, XMLWriter {
public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReadable {
private static final int MAX_SHOW_NUM = 10;
private static final String VERSION_80 = "80";
@ -105,20 +121,25 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/
public static final String DEFAULT_WORKSPACE_PATH = "fr.designer.workspace.default";
public static final String LAST_EAST_REGION_LAYOUT = "LastEastRegionLayout";
public static final String LAST_WEST_REGION_LAYOUT = "LastWestRegionLayout";
private static DesignerEnvManager designerEnvManager; // gui.
private String activationKey = null;
private String logLocation = null;
private Rectangle windowBounds = null; // window bounds.
private String DialogCurrentDirectory = null;
private String CurrentDirectoryPrefix = null;
private Map<String, List<String>> recentOpenedFileListMap = new HashMap<>();
private List<String> tempRecentOpenedFilePathList = new ArrayList<String>();
private XmlElement<Map<String, List<String>>> recentOpenedMapping = SimpleXmlElement.of(recentOpenedFileListMap);
private boolean showPaintToolBar = true;
private int maxNumberOrPreviewRow = 200;
// name和Env的键值对
private Map<String, DesignerWorkspaceInfo> nameEnvMap = new ListMap<>();
// marks: 当前报表服务器名字
private String curEnvName = null;
private XmlElement<EnvConfiguration> envConfig = SimpleXmlElement.of(new EnvConfiguration());
private boolean showProjectPane = true;
private boolean showDataPane = true;
//p:这是当前选择的数据库连接的名字,这个在新建数据源的时候用到.
@ -181,7 +202,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
/**
* alphafine
*/
private AlphaFineConfigManager alphaFineConfigManager = AlphaFineConfigManager.getInstance();
private XmlElement<AlphaFineConfigManager> alphaFineConfigManager = SimpleXmlElement.of(AlphaFineConfigManager.getInstance());
/**
* 阅后即焚的配置项
@ -230,7 +251,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private boolean propertiesUsable;
private SimpleDesignerConfig fvsDesignerConfig = SimpleDesignerConfig.getInstance("FvsDesignerConfig");
private XmlElement<SimpleDesignerConfig> fvsDesignerConfig = SimpleXmlElement.of(SimpleDesignerConfig.getInstance("FvsDesignerConfig"));
/**
* DesignerEnvManager.
@ -244,13 +265,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
designerEnvManager = new DesignerEnvManager();
//REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China
GeneralContext.setLocale(designerEnvManager.getLanguage());
try {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (FileNotFoundException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
if (!asyncInitEnvManager()) {
// 如果异步读取失败, 则恢复原来的逻辑
compatibleInitEnvManager();
}
// james:如果没有env定义,要设置一个默认的
@ -268,12 +286,46 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return designerEnvManager;
}
private static void compatibleInitEnvManager() {
try {
XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile());
} catch (FileNotFoundException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
XmlHandler.Self.handle(e);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
/**
* 异步初始化环境管理, 提供配置, 帮助处理预期外的问题
* 1-当优化开启时才走异步逻辑
* 2-如果异步执行中出错则返回异常 false, 否则返回 true
*
* @return /
*/
private static boolean asyncInitEnvManager() {
AtomicBoolean noEx = new AtomicBoolean(false);
OptimizeUtil.open(DesignerEnvManager.class.getSimpleName().toLowerCase(), OptimizeUtil.Module.COMMON, () -> {
try {
designerEnvManager.initElements(designerEnvManager.getDesignerEnvFile());
noEx.set(true);
} catch (Throwable retryEx) {
FineLoggerFactory.getLogger().debug("try async init DesignerEnvManager failed", retryEx);
}
});
return noEx.get();
}
public ColorSelectConfigManager getColorConfigManager() {
return this.configManager;
}
public static void checkNameEnvMap() {
if (designerEnvManager == null || designerEnvManager.nameEnvMap.size() > 0) {
if (designerEnvManager == null || designerEnvManager.getNameEnvMap().size() > 0) {
return;
}
String installHome = StableUtils.getInstallHome();
@ -443,8 +495,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
// 清空前一个版本中的工作目录和最近打开
nameEnvMap = new ListMap<String, DesignerWorkspaceInfo>();
curEnvName = null;
getEnvConfig().setNameEnvMap(new ListMap<>());
getEnvConfig().setCurEnvName(null);
designerEnvManager.saveXMLFile();
}
@ -606,7 +658,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
String installHome = StableUtils.getInstallHome();
String defaultenvPath = getDefaultenvPath(installHome);
defaultenvPath = new File(defaultenvPath).getPath();
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator();
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = getNameEnvMap().entrySet().iterator();
while (entryIt.hasNext()) {
Entry<String, DesignerWorkspaceInfo> entry = entryIt.next();
DesignerWorkspaceInfo env = entry.getValue();
@ -627,8 +679,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
String installHome = StableUtils.getInstallHome();
String defaultenvPath = getDefaultenvPath(installHome);
defaultenvPath = new File(defaultenvPath).getPath();
if (nameEnvMap.size() >= 0) {
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator();
if (getNameEnvMap().size() >= 0) {
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = getNameEnvMap().entrySet().iterator();
while (entryIt.hasNext()) {
Entry<String, DesignerWorkspaceInfo> entry = entryIt.next();
DesignerWorkspaceInfo env = entry.getValue();
@ -1019,21 +1071,21 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
public SimpleDesignerConfig getFvsDesignerConfig() {
return fvsDesignerConfig;
return fvsDesignerConfig.getValue();
}
/**
* 返回环境名称迭代器
*/
public Iterator<String> getEnvNameIterator() {
return this.nameEnvMap.keySet().iterator();
return this.getNameEnvMap().keySet().iterator();
}
/**
* 根据名称返回环境
*/
public DesignerWorkspaceInfo getWorkspaceInfo(String name) {
return this.nameEnvMap.get(name);
return this.getNameEnvMap().get(name);
}
/**
@ -1044,7 +1096,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/
public void putEnv(String name, DesignerWorkspaceInfo info) {
this.nameEnvMap.put(name, info);
this.getNameEnvMap().put(name, info);
}
/**
@ -1053,14 +1105,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* @param name 环境的名字
*/
public void removeEnv(String name) {
this.nameEnvMap.remove(name);
this.getNameEnvMap().remove(name);
}
/**
* 清除全部环境
*/
public void clearAllEnv() {
this.nameEnvMap.clear();
this.getNameEnvMap().clear();
}
/**
@ -1082,14 +1134,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
* 返回当前环境的名称.
*/
public String getCurEnvName() {
return this.curEnvName;
return getEnvConfig().getCurEnvName();
}
/**
* 设置当前环境的名称
*/
public void setCurEnvName(String envName) {
this.curEnvName = envName;
getEnvConfig().setCurEnvName(envName);
}
/**
@ -1146,12 +1198,12 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (StringUtils.isEmpty(envName)) {
return tempRecentOpenedFilePathList;
} else {
if (!recentOpenedFileListMap.containsKey(envName)) {
recentOpenedFileListMap.put(envName, tempRecentOpenedFilePathList);
if (!recentOpenedMapping.getValue().containsKey(envName)) {
recentOpenedMapping.getValue().put(envName, tempRecentOpenedFilePathList);
}
}
return recentOpenedFileListMap.get(envName);
return recentOpenedMapping.getValue().get(envName);
}
/**
@ -1755,11 +1807,11 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
public AlphaFineConfigManager getAlphaFineConfigManager() {
return alphaFineConfigManager;
return alphaFineConfigManager.getValue();
}
public void setAlphaFineConfigManager(AlphaFineConfigManager alphaFineConfigManager) {
this.alphaFineConfigManager = alphaFineConfigManager;
this.alphaFineConfigManager.setValue(alphaFineConfigManager);
}
public boolean isImageCompress() {
@ -1802,6 +1854,100 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.layoutTemplateStyle = layoutTemplateStyle;
}
@Override
public void initElements(File xmlFile) throws XmlException {
try {
backupOldXmlFile();
XmlInitialFactory xmlInitialFactory = XmlInitialFactory.create(xmlFile);
xmlInitialFactory
.init("XMLVersion", DesignerEnvManager.this::readXMLVersion)
.init("Attributes", DesignerEnvManager.this::readAttributes)
.init("ReportPaneAttributions", DesignerEnvManager.this::readReportPaneAttributions)
.init("RecentOpenedFilePath", (e) -> {
this.recentOpenedMapping = AsyncXmlElement.of(DesignerStartupPool.common(), () -> {
DesignerEnvManager.this.readRecentOpenFileList0(e);
return recentOpenedFileListMap;
}).callback(new Callback<Map<String, List<String>>>() {
@Override
public void exec(Map<String, List<String>> stringListMap) {
checkRecentOpenedFileNum();
}
});
})
.init("EnvConfigMap", (e) -> {
final EnvConfiguration previousConfig = this.envConfig.getValue();
this.envConfig = AsyncXmlElement.of(DesignerStartupPool.common(), () -> {
DesignerEnvManager.this.readEnvConfigMap(e, previousConfig);
return previousConfig;
});
})
.init("LogLocation", DesignerEnvManager.this::readLogLocation)
.init("Language", DesignerEnvManager.this::readLanguage)
.init("JettyServerPort", DesignerEnvManager.this::readJettyPort)
.init("PLengthUnit", DesignerEnvManager.this::readPageLengthUnit)
.init("RLengthUnit", DesignerEnvManager.this::readReportLengthUnit)
.init("LastOpenFilePath", DesignerEnvManager.this::readLastOpenFile)
.init("EncryptionKey", DesignerEnvManager.this::readEncrytionKey)
.init("jdkHome", (e) -> this.jdkHome = e.getElementValue())
.init("lastBBSTime", DesignerEnvManager.this::readLastBBSTime)
.init("lastBBSNewsTime", DesignerEnvManager.this::readLastBBSNewsTime)
.init("ActivationKey", DesignerEnvManager.this::readActiveKey)
.init("status", DesignerEnvManager.this::readActiveStatus)
.init(CAS_PARAS, DesignerEnvManager.this::readHttpsParas)
.init(EnvDetectorConfig.XML_TAG, DesignerEnvManager.this::readEnvDetectorConfig)
.init(DesignerStartupConfig.XML_TAG, DesignerEnvManager.this::readStartupConfig)
.init("AlphaFineConfigManager", (e) -> {
this.alphaFineConfigManager = AsyncXmlElement.of(DesignerStartupPool.common(), () -> {
AlphaFineConfigManager config = AlphaFineConfigManager.getInstance();
e.readXMLObject(config);
return config;
});
})
.init("RecentColors", DesignerEnvManager.this::readRecentColor)
.init("OpenDebug", DesignerEnvManager.this::readOpenDebug)
.init(ComponentReuseNotificationInfo.XML_TAG, DesignerEnvManager.this::readComponentReuseNotificationInfo)
.init(DesignerPushUpdateConfigManager.XML_TAG, DesignerEnvManager.this::readDesignerPushUpdateAttr)
.init(VcsConfigManager.XML_TAG, DesignerEnvManager.this::readVcsAttr)
.init(DesignerPort.XML_TAG, DesignerEnvManager.this::readDesignerPort)
.init(SnapChatConfig.XML_TAG, DesignerEnvManager.this::readSnapChatConfig)
.init(DesignerLoginConfigManager.XML_TAG, DesignerEnvManager.this::readDesignerLoginAttr)
.init(fvsDesignerConfig.getValue().getName(), (e) -> {
SimpleDesignerConfig config = this.fvsDesignerConfig.getValue();
this.fvsDesignerConfig = AsyncXmlElement.of(() -> {
e.readXMLObject(config);
return config;
});
})
.init(SwitchForSwingChecker.XML_TAG, DesignerEnvManager.this::readSwitchForSwingCheckerAttr)
.init(LAST_WEST_REGION_LAYOUT, DesignerEnvManager.this::readLastWestRegionLayout)
.init(LAST_EAST_REGION_LAYOUT, DesignerEnvManager.this::readLastEastRegionLayout);
} catch (Exception e) {
throw new XmlException(e);
}
}
/**
* 备份老的 xml 文件, 防止第一次修改存在问题
* 但是只备份一次其他都走老逻辑
*/
private void backupOldXmlFile() {
try {
File oldFile = getEnvFile();
String newFilePath = ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "Env_backup.xml";
File newFile = new File(newFilePath);
if (newFile.exists()) {
return;
}
if (oldFile.exists()) {
FileUtils.copyFile(oldFile, newFile);
}
} catch (Exception ignored) {
}
}
/**
* Read XML.<br>
* The method will be invoked when read data from XML file.<br>
@ -1865,7 +2011,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readComponentReuseNotificationInfo(reader);
} else if (name.equals(DesignerPushUpdateConfigManager.XML_TAG)) {
readDesignerPushUpdateAttr(reader);
} else if (name.equals(vcsConfigManager.XML_TAG)) {
} else if (name.equals(VcsConfigManager.XML_TAG)) {
readVcsAttr(reader);
} else if (DesignerPort.XML_TAG.equals(name)) {
readDesignerPort(reader);
@ -1873,7 +2019,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
readSnapChatConfig(reader);
} else if (name.equals(DesignerLoginConfigManager.XML_TAG)) {
readDesignerLoginAttr(reader);
} else if (name.equals(fvsDesignerConfig.getName())) {
} else if (name.equals(fvsDesignerConfig.getValue().getName())) {
readFvsDesignerConfig(reader);
} else if (name.equals(SwitchForSwingChecker.XML_TAG)) {
readSwitchForSwingCheckerAttr(reader);
@ -1893,7 +2039,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
private void readAlphaFineAttr(XMLableReader reader) {
reader.readXMLObject(this.alphaFineConfigManager = AlphaFineConfigManager.getInstance());
AlphaFineConfigManager config = AlphaFineConfigManager.getInstance();
reader.readXMLObject(config);
this.alphaFineConfigManager = SimpleXmlElement.of(config);
}
private void readEnvDetectorConfig(XMLableReader reader) {
@ -1918,9 +2067,9 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private void readLayout(XMLableReader reader, String name) {
if ("LastEastRegionLayout".equals(name)) {
if (LAST_EAST_REGION_LAYOUT.equals(name)) {
this.readLastEastRegionLayout(reader);
} else if ("LastWestRegionLayout".equals(name)) {
} else if (LAST_WEST_REGION_LAYOUT.equals(name)) {
this.readLastWestRegionLayout(reader);
}
}
@ -2016,6 +2165,40 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
private void readEnvConfigMap(XMLableReader reader, EnvConfiguration envConfigs) {
String currentEnv = reader.getAttrAsString("currentEnv", StringUtils.EMPTY);
envConfigs.setCurEnvName(currentEnv);
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
if (reader.isAttr()) {
envConfigs.getNameEnvMap().clear();
} else if (reader.isChildNode()) {
String tagName = reader.getTagName();
if ("EnvConfigElement".equals(tagName)) {
final String name = reader.getAttrAsString("name", StringUtils.EMPTY);
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
if (reader.isChildNode()) {
String tagName = reader.getTagName();
if (DesignerWorkspaceType.Local.toString().equals(tagName)) {
LocalDesignerWorkspaceInfo envConfig = (LocalDesignerWorkspaceInfo) GeneralXMLTools.readXMLable(reader);
envConfigs.getNameEnvMap().put(name, envConfig);
} else if (DesignerWorkspaceType.Remote.toString().equals(tagName)) {
RemoteDesignerWorkspaceInfo envConfig = (RemoteDesignerWorkspaceInfo) GeneralXMLTools.readXMLable(reader);
envConfigs.getNameEnvMap().put(name, envConfig);
}
}
}
});
}
}
}
});
}
private void readEnvConfigMap(XMLableReader reader) {
String currentEnv = reader.getAttrAsString("currentEnv", StringUtils.EMPTY);
this.setCurEnvName(currentEnv);
@ -2050,6 +2233,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
private void readRecentOpenFileList(XMLableReader reader) {
readRecentOpenFileList0(reader);
checkRecentOpenedFileNum();
}
private void readRecentOpenFileList0(XMLableReader reader) {
reader.readXMLObject(new XMLReadable() {
@Override
public void readXML(XMLableReader reader) {
@ -2081,7 +2271,6 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
}
});
checkRecentOpenedFileNum();
}
private void readDesignerPushUpdateAttr(XMLableReader reader) {
@ -2151,7 +2340,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private void writeAlphaFineAttr(XMLPrintWriter writer) {
if (this.alphaFineConfigManager != null) {
this.alphaFineConfigManager.writeXML(writer);
this.alphaFineConfigManager.getValue().writeXML(writer);
}
}
@ -2228,10 +2417,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
writer.end();
writer.startTAG("EnvConfigMap");
if (this.curEnvName != null) {
writer.attr("currentEnv", this.curEnvName);
if (this.getCurEnvName() != null) {
writer.attr("currentEnv", this.getCurEnvName());
}
for (Entry<String, DesignerWorkspaceInfo> entry : nameEnvMap.entrySet()) {
for (Entry<String, DesignerWorkspaceInfo> entry : getNameEnvMap().entrySet()) {
writer.startTAG("EnvConfigElement").attr("name", entry.getKey());
DesignerWorkspaceInfo envConfig = entry.getValue();
GeneralXMLTools.writeXMLable(writer, envConfig, envConfig.getType().toString());
@ -2440,11 +2629,14 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
}
private void readFvsDesignerConfig(XMLableReader reader) {
reader.readXMLObject(fvsDesignerConfig);
SimpleDesignerConfig config = fvsDesignerConfig.getValue();
reader.readXMLObject(config);
fvsDesignerConfig = SimpleXmlElement.of(config);
}
private void writeFvsDesignerConfig(XMLPrintWriter writer) {
this.fvsDesignerConfig.writeXML(writer);
this.fvsDesignerConfig.getValue().writeXML(writer);
}
private void writeSwitchForSwingChecker(XMLPrintWriter writer) {
@ -2479,4 +2671,39 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public SnapChatConfig getSnapChatConfig() {
return snapChatConfig;
}
private EnvConfiguration getEnvConfig() {
return envConfig.getValue();
}
private Map<String, DesignerWorkspaceInfo> getNameEnvMap() {
return getEnvConfig().getNameEnvMap();
}
private static class EnvConfiguration {
// name和Env的键值对
private Map<String, DesignerWorkspaceInfo> nameEnvMap = new ListMap<>();
// marks: 当前报表服务器名字
private String curEnvName = null;
public Map<String, DesignerWorkspaceInfo> getNameEnvMap() {
return nameEnvMap;
}
public void setNameEnvMap(Map<String, DesignerWorkspaceInfo> nameEnvMap) {
this.nameEnvMap = nameEnvMap;
}
public String getCurEnvName() {
return curEnvName;
}
public void setCurEnvName(String curEnvName) {
this.curEnvName = curEnvName;
}
}
}

30
designer-base/src/main/java/com/fr/design/actions/core/ActionFactory.java

@ -6,6 +6,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.selection.QuickEditor;
import com.fr.design.ui.util.UIUtil;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
@ -32,6 +33,7 @@ public class ActionFactory {
private static Set<Class<?>> actionClasses = new CopyOnWriteArraySet<>();
private static Set<Class<?>> floatActionClasses = new CopyOnWriteArraySet<>();
private static Class chartCollectionClass = null;
/**
* 无需每次实例化的悬浮元素编辑器
*/
@ -57,7 +59,6 @@ public class ActionFactory {
private ActionFactory() {
}
/**
* 元素编辑器释放模板对象
*/
@ -70,6 +71,33 @@ public class ActionFactory {
}
}
/**
* 注册异步加载的单元格编辑器
* 首先放到 classMap 当初始化成功后则移除并放到 cellEditor
* 如果已经存在则覆盖
*
* @param keyClazz 作为 key 的类
* @param editorClazz 作为 编辑器 的类
*/
public static void registerAsyncInitCellEditorClass(Class keyClazz, Class<? extends QuickEditor> editorClazz) {
cellEditorClass.put(keyClazz, editorClazz);
// 这里直接用 invokeLater 放到 UI 线程中去调用。
// 不阻塞主逻辑的启动
UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
try {
QuickEditor quickEditor = editorClazz.newInstance();
cellEditorClass.remove(keyClazz);
cellEditor.put(keyClazz, quickEditor);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
});
}
/**
* 注册无需每次实例化的单元格元素编辑器

8
designer-base/src/main/java/com/fr/design/actions/file/CloseCurrentTemplateAction.java

@ -3,7 +3,7 @@ package com.fr.design.actions.file;
import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.KeySetUtils;
@ -28,9 +28,9 @@ public class CloseCurrentTemplateAction extends UpdateAction {
* @param e 事件
*/
public void actionPerformed(ActionEvent e) {
MutilTempalteTabPane.getInstance().setIsCloseCurrent(true);
MutilTempalteTabPane.getInstance().closeFormat(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
MultiTemplateTabPane.getInstance().setIsCloseCurrent(true);
MultiTemplateTabPane.getInstance().closeFormat(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
@Override

5
designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java

@ -7,7 +7,7 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.FileOperations;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
@ -16,7 +16,6 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager;
import com.fr.design.mainframe.vcs.common.VcsHelper;
import com.fr.design.utils.TemplateUtils;
import com.fr.design.utils.gui.GUICoreUtils;
@ -89,7 +88,7 @@ public class RenameAction extends UpdateAction {
}
new FileRenameDialog(node);
MutilTempalteTabPane.getInstance().repaint();
MultiTemplateTabPane.getInstance().repaint();
DesignerFrameFileDealerPane.getInstance().stateChange();
}

3
designer-base/src/main/java/com/fr/design/carton/EventDispatchThreadHangMonitor.java

@ -1,6 +1,7 @@
package com.fr.design.carton;
import com.fr.concurrent.FineExecutors;
import com.fr.design.ui.util.UIUtil;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
@ -314,7 +315,7 @@ public final class EventDispatchThreadHangMonitor extends EventQueue {
* 将swing中默认的EventQueue换成自己的
*/
public static void initMonitoring() {
Toolkit.getDefaultToolkit().getSystemEventQueue().push(INSTANCE);
UIUtil.invokeLaterIfNeeded(() -> Toolkit.getDefaultToolkit().getSystemEventQueue().push(INSTANCE));
}
/**

6
designer-base/src/main/java/com/fr/design/data/StrategyConfigAttrUtils.java

@ -11,11 +11,11 @@ import com.fr.esd.event.DSMapping;
import com.fr.esd.event.DsNameTarget;
import com.fr.esd.event.StrategyEventsNotifier;
import com.fr.esd.event.xml.XMLSavedHook;
import com.fr.file.FILE;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@ -46,7 +46,9 @@ public class StrategyConfigAttrUtils {
}
//新建模版此时不存在,不需要注册钩子
if (attr.getXmlSavedHook() == null && WorkContext.getWorkResource().exist(jTemplate.getPath())) {
//不处理外部路径,保存到设计器才处理
String path = jTemplate.getPath();
if (attr.getXmlSavedHook() == null && !Paths.get(path).isAbsolute() && WorkContext.getWorkResource().exist(path)) {
attr.setXmlSavedHook(new StrategyConfigsAttrSavedHook(jTemplate.getPath(), attr));
}
return attr;

11
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -257,12 +257,21 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
}
private boolean saveByOldWay(List<String> removedConnNames, List<ConnectionBean> addedOrUpdatedConnections) {
final int remaining = ConnectionConfig.getInstance().getRemainingCon(removedConnNames.size(), addedOrUpdatedConnections.size());
try {
return Configurations.modify(new WorkerFacade(ConnectionConfig.class) {
@Override
public void run() {
removedConnNames.forEach(n -> ConnectionConfig.getInstance().removeConnection(n));
addedOrUpdatedConnections.forEach(cb -> ConnectionConfig.getInstance().addConnection(cb.getName(), cb.getConnection()));
int innerRemaining = remaining;
for (ConnectionBean cb : addedOrUpdatedConnections) {
if (innerRemaining > 0) {
ConnectionConfig.getInstance().addConnectionWithoutCheck(cb.getName(), cb.getConnection());
innerRemaining--;
} else {
break;
}
}
}
});
} catch (Exception e) {

355
designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java

@ -3,17 +3,23 @@
*/
package com.fr.design.data.datapane.preview;
import com.fr.base.BaseUtils;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.data.TableDataSource;
import com.fr.data.desensitize.base.DesensitizationTableData;
import com.fr.data.impl.DBTableData;
import com.fr.data.impl.EmbeddedTableData;
import com.fr.data.impl.NameDataModel;
import com.fr.data.operator.DataOperator;
import com.fr.design.DesignerEnvManager;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.preview.desensitization.TableDataPreviewDesensitizeManager;
import com.fr.design.data.datapane.preview.desensitization.model.DesensitizedPreviewTableModel;
import com.fr.design.data.datapane.preview.desensitization.view.PreviewTableDesensitizationPane;
import com.fr.design.data.datapane.preview.desensitization.view.setting.TableDataDesensitizationSettingPane;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.frpane.UITabbedPane;
@ -25,6 +31,7 @@ import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil;
import com.fr.function.TIME;
import com.fr.general.FRFont;
@ -39,6 +46,7 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableCellRenderer;
@ -49,20 +57,20 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CancellationException;
/**
* august PreviewTablePane一共提供5个共有的静态方法用来预览
*/
public class PreviewTablePane extends BasicPane {
private TableData tableData;
private DataModel dataModel;
private UINumberField maxPreviewNumberField;
@ -78,6 +86,54 @@ public class PreviewTablePane extends BasicPane {
private static PreviewTablePane THIS;
private EmbeddedTableData previewTableData;
private PreviewTableDesensitizationPane desensitizationPane;
/**
* 用于refreshLabel的鼠标监听
*/
private final MouseAdapter refreshLabelMouseAdapter = new MouseAdapter() {
boolean mouseEntered = false;
boolean buttonPressed = false;
@Override
public void mouseEntered(MouseEvent e) { // 当鼠标进入时候调用.
mouseEntered = true;
if (!buttonPressed) {
refreshLabel.setBackground(java.awt.Color.WHITE);
refreshLabel.setOpaque(true);
refreshLabel.setBorder(BorderFactory.createLineBorder(java.awt.Color.GRAY));
}
}
@Override
public void mouseExited(MouseEvent e) {
mouseEntered = false;
refreshLabel.setOpaque(false);
refreshLabel.setBorder(BorderFactory.createEmptyBorder());
}
@Override
public void mousePressed(MouseEvent e) {
buttonPressed = true;
refreshLabel.setBackground(java.awt.Color.lightGray);
}
@Override
public void mouseReleased(MouseEvent e) {
buttonPressed = false;
if (mouseEntered) {
refreshLabel.setBackground(java.awt.Color.WHITE);
try {
populate(tableData);
if (dataModel != null) {
setRowsLimitTableModel();
}
} catch (Exception ignore) {
}
}
}
};
public static final PreviewTablePane getInstance() {
if (THIS == null) {
THIS = new PreviewTablePane();
@ -87,91 +143,145 @@ public class PreviewTablePane extends BasicPane {
private PreviewTablePane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
// northPane
this.add(initNorthPane(), BorderLayout.NORTH);
// centerPane
this.add(initCenterPane(), BorderLayout.CENTER);
// dialog
initDialog();
// progressBar
initProgressBar();
}
// elalke:预览行数
JPanel previewNumberPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
this.add(previewNumberPanel, BorderLayout.NORTH);
/**
* 初始化northPane
*
* @return
*/
private JComponent initNorthPane() {
JPanel northPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// 预览行数面板
northPane.add(initPreviewNumberPane(), BorderLayout.CENTER);
/// 迭代延期,暂时屏蔽下功能入口
// 脱敏预览设置面板
// northPane.add(initDesensitizationPane(), BorderLayout.EAST);
initDesensitizationPane();
return northPane;
}
/**
* 初始化预览行数面板
*
* @return
*/
private JComponent initPreviewNumberPane() {
JPanel previewNumberPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
// 当前行数
JPanel currentPreviewPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
previewNumberPanel.add(currentPreviewPanel);
currentPreviewPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Current_Preview_Rows") + ":"));
currentRowsField = new UINumberField();
currentPreviewPanel.add(currentRowsField);
currentRowsField.setEditable(false);
currentRowsField.setColumns(4);
currentRowsField.setInteger(true);
// 最大行数
JPanel maxPanel = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
previewNumberPanel.add(maxPanel);
maxPanel.add(new UILabel(Toolkit.i18nText("Fine-Design_Basic_Datasource_Maximum_Number_of_Preview_Rows") + ":"));
maxPreviewNumberField = new UINumberField();
maxPanel.add(maxPreviewNumberField);
maxPreviewNumberField.setColumns(4);
maxPreviewNumberField.setInteger(true);
maxPreviewNumberField.setValue(DesignerEnvManager.getEnvManager().getMaxNumberOrPreviewRow());
maxPreviewNumberField.addActionListener(event -> {
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
maxPreviewNumberField.setValue(designerEnvManager.getMaxNumberOrPreviewRow());
maxPreviewNumberField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager();
designerEnvManager.setMaxNumberOrPreviewRow((int) ((UINumberField) evt.getSource()).getValue());
}
designerEnvManager.setMaxNumberOrPreviewRow((int) ((UINumberField) event.getSource()).getValue());
});
// 刷新按钮
initRefreshLabel();
Icon refreshImage = BaseUtils.readIcon("/com/fr/design/images/control/refresh.png");
refreshLabel = new UILabel(refreshImage);
previewNumberPanel.add(currentPreviewPanel);
previewNumberPanel.add(maxPanel);
previewNumberPanel.add(refreshLabel);
refreshLabel.addMouseListener(new MouseAdapter() {
boolean mouseEntered = false;
boolean buttonPressed = false;
public void mouseEntered(MouseEvent e) { // 当鼠标进入时候调用.
mouseEntered = true;
if (!buttonPressed) {
refreshLabel.setBackground(java.awt.Color.WHITE);
refreshLabel.setOpaque(true);
refreshLabel.setBorder(BorderFactory.createLineBorder(java.awt.Color.GRAY));
}
return previewNumberPanel;
}
public void mouseExited(MouseEvent e) {
mouseEntered = false;
refreshLabel.setOpaque(false);
refreshLabel.setBorder(BorderFactory.createEmptyBorder());
private void initRefreshLabel() {
Icon refreshImage = IconUtils.readIcon("/com/fr/design/images/control/refresh");
refreshLabel = new UILabel(refreshImage);
refreshLabel.addMouseListener(refreshLabelMouseAdapter);
}
public void mousePressed(MouseEvent e) {
buttonPressed = true;
refreshLabel.setBackground(java.awt.Color.lightGray);
/**
* 初始化脱敏设置面板
*
* @return
*/
private JComponent initDesensitizationPane() {
desensitizationPane = new PreviewTableDesensitizationPane(this);
return desensitizationPane;
}
public void mouseReleased(MouseEvent e) {
buttonPressed = false;
if (mouseEntered) {
refreshLabel.setBackground(java.awt.Color.WHITE);
try {
populate(tableData);
if (dataModel != null) {
setRowsLimitTableModel();
/**
* 点击脱敏配置后的操作
*/
public void clickDesensitizationLabel() {
TableDataDesensitizationSettingPane settingPane = new TableDataDesensitizationSettingPane((DesensitizationTableData) tableData);
settingPane.populateBean((DesensitizationTableData) tableData);
BasicDialog dialog = settingPane.showWindowWithCustomSize(SwingUtilities.getWindowAncestor(PreviewTablePane.this), new DialogActionAdapter() {
@Override
public void doOk() {
// 保存脱敏规则配置
settingPane.updateBean();
// 改变模板保存状态
JTemplate<?, ?> editingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (Objects.nonNull(editingTemplate)) {
editingTemplate.fireTargetModified(true);
}
} catch (Exception e1) {
}
@Override
public void doCancel() {
}
}, BasicDialog.DEFAULT);
dialog.setVisible(true);
// 关闭预览页面
PreviewTablePane.this.dialog.setVisible(false);
}
});
/**
* 设置脱敏设置的个数
*
* @param model
*/
private void setDesensitizationCount(TableModel model) {
desensitizationPane.setDesensitizationCount(isDesensitizeOpened(),
model instanceof DesensitizedPreviewTableModel ?
((DesensitizedPreviewTableModel) model).getDesensitizeColumnsCount() :
0);
}
/**
* 初始化centerPane
*
* @return
*/
private JComponent initCenterPane() {
preveiwTable = new CopyableJTable(new TableSorter());
preveiwTable.setRowSelectionAllowed(false);
preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
return new JScrollPane(preveiwTable);
}
this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER);
private void initDialog() {
if (this.dialog == null) {
this.dialog = this.showWindow(new JFrame());
}
}
private void initProgressBar() {
progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) {
@Override
public void doMonitorCanceled() {
if (getWorker() != null) {
getWorker().cancel(true);
@ -182,7 +292,7 @@ public class PreviewTablePane extends BasicPane {
}
public AutoProgressBar getProgressBar() {
return this.progressBar;
return PreviewTablePane.progressBar;
}
@Override
@ -223,9 +333,10 @@ public class PreviewTablePane extends BasicPane {
}
/**
* elake:为预览表的columnIndex列着色.
* @param columnIndex
* @param c
* 为预览表的columnIndex列着色.
*
* @param columnIndex 列索引值
* @param c 颜色
*/
private void setPreviewTableColumnColor(final int columnIndex, final Color c) {
addLoadedListener(new LoadedEventListener() {
@ -233,6 +344,7 @@ public class PreviewTablePane extends BasicPane {
public void fireLoaded() {
TableColumn column = preveiwTable.getColumnModel().getColumn(columnIndex);
DefaultTableCellRenderer cellRenderer = new DefaultTableCellRenderer() {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
comp.setBackground(c);
@ -253,7 +365,7 @@ public class PreviewTablePane extends BasicPane {
getInstance().preveiwTable = new SortableJTable(new TableSorter());
getInstance().preveiwTable.setRowSelectionAllowed(false);
getInstance().preveiwTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
getInstance().progressBar.close();
PreviewTablePane.progressBar.close();
getInstance().repaint();
}
@ -335,6 +447,7 @@ public class PreviewTablePane extends BasicPane {
private void previewTableDataSQL() throws Exception {
connectionBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Utils_Now_Create_Connection"), "", 0, 100) {
@Override
public void doMonitorCanceled() {
getWorker().cancel(true);
getDialog().setVisible(false);
@ -349,7 +462,19 @@ public class PreviewTablePane extends BasicPane {
private void setPreviewTableColumnValue(final Graphics g) {
for (int i = 0; i < preveiwTable.getColumnModel().getColumnCount(); i++) {
TableColumn column = preveiwTable.getColumnModel().getColumn(i);
DefaultTableCellRenderer cellRenderer = new DefaultTableCellRenderer() {
DefaultTableCellRenderer cellRenderer = getDefaultTableCellRenderer();
column.setCellRenderer(cellRenderer);
}
}
/**
* 默认表格格子渲染器
*
* @return
*/
private DefaultTableCellRenderer getDefaultTableCellRenderer() {
return new DefaultTableCellRenderer() {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
Font f = table.getFont();
@ -368,23 +493,18 @@ public class PreviewTablePane extends BasicPane {
return comp;
}
};
column.setCellRenderer(cellRenderer);
}
}
private void setWorker() {
worker = new SwingWorker<PreviewTableModel, Void>() {
protected PreviewTableModel doInBackground() throws Exception {
worker = new SwingWorker<TableModel, Void>() {
@Override
protected TableModel doInBackground() throws Exception {
connectionBar.start();
try {
if (tableData instanceof DBTableData) {
boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase());
if (!status) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}
}
testDBTableDataConnection(tableData);
} finally {
// 将close操作放到EDT线程中
UIUtil.invokeLaterIfNeeded(() -> connectionBar.close());
@ -394,22 +514,20 @@ public class PreviewTablePane extends BasicPane {
// parameterInputDialog
// update之后的parameters,转成一个parameterMap,用于预览TableData
PreviewTableModel previewModel = new PreviewTableModel(previewTableData.createDataModel(null), (int) maxPreviewNumberField.getValue());
for (int i = 0; i < previewTableData.getColumnCount(); i++) {
Class<?> cls = previewTableData.getColumnClass(i);
if (cls == Date.class || cls == TIME.class || cls == Timestamp.class) {
previewModel.dateIndexs.add(i);
}
if (TableDataPreviewDesensitizeManager.getInstance().needDesensitize(tableData)) {
// 数据集预览脱敏
previewModel = TableDataPreviewDesensitizeManager.getInstance().desensitizeTableModel(tableData, previewModel);
}
dealWithPreviewTableModelColumnClass(previewModel, previewTableData);
return previewModel;
}
@Override
public void done() {
try {
PreviewTableModel model = get();
setModel(model);
setCurrentRows(model.getRowCount());
TableModel model = get();
setPreviewTableModel(model);
setPreviewTableColumnValue(getParent().getGraphics());
fireLoadedListener();
} catch (Exception e) {
if (!(e instanceof CancellationException)) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
@ -424,6 +542,36 @@ public class PreviewTablePane extends BasicPane {
};
}
/**
* 检查DBTableData连接
*
* @param tableData
* @throws Exception
*/
private void testDBTableDataConnection(TableData tableData) throws Exception {
if (tableData instanceof DBTableData) {
boolean status = DataOperator.getInstance().testConnection(((DBTableData) tableData).getDatabase());
if (!status) {
throw new Exception(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Failed"));
}
}
}
/**
* 处理预览Model的列类型
*
* @param previewModel
* @param previewTableData
*/
private void dealWithPreviewTableModelColumnClass(PreviewTableModel previewModel, EmbeddedTableData previewTableData) {
for (int i = 0; i < previewTableData.getColumnCount(); i++) {
Class<?> cls = previewTableData.getColumnClass(i);
if (cls == Date.class || cls == TIME.class || cls == Timestamp.class) {
previewModel.dateIndexs.add(i);
}
}
}
/**
* 直接预览存储过程的一个返回数据集没有实际值和显示值
*
@ -532,9 +680,62 @@ public class PreviewTablePane extends BasicPane {
} catch (Exception e) {
previewModel = new PreviewTableModel((int) maxPreviewNumberField.getValue());
}
setModel(previewModel);
setCurrentRows(previewModel.getRowCount());
setPreviewTableModel(previewModel);
}
/**
* 切换TableModel的展示状态
*/
public void togglePreviewTableModelDesensitizeStatus() {
if (!isDesensitizeOpened()) {
// 未启用数据脱敏时,不需要切换
return;
}
TableSorter tableSorter = (TableSorter) preveiwTable.getModel();
TableModel originTableModel = tableSorter.getTableModel();
if (originTableModel instanceof DesensitizedPreviewTableModel) {
((DesensitizedPreviewTableModel) originTableModel).toggleNeedDesensite();
}
}
/**
* 刷新一下预览页面用于切换脱敏和非脱敏时的显示
*/
public void refreshTable() {
TableModel originTableModel = getCurrentTableModel();
setPreviewTableModel(originTableModel);
}
/**
* 获取当前的TableModel已经除掉了TableSorter的包装
*
* @return
*/
private TableModel getCurrentTableModel() {
TableSorter tableSorter = (TableSorter) preveiwTable.getModel();
return tableSorter.getTableModel();
}
/**
* 设置预览TableModel
*
* @param previewTableModel
*/
private void setPreviewTableModel(TableModel previewTableModel) {
setDesensitizationCount(previewTableModel);
setModel(previewTableModel);
setCurrentRows(previewTableModel.getRowCount());
fireLoadedListener();
}
/**
* 数据脱敏是否启用
*
* @return
*/
private boolean isDesensitizeOpened() {
return tableData instanceof DesensitizationTableData &&
((DesensitizationTableData) tableData).getDesensitizationConfig().isDesensitizeOpened();
}
}

120
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/PreviewTableDesensitizationPane.java

@ -0,0 +1,120 @@
package com.fr.design.data.datapane.preview.desensitization.view;
import com.fr.base.svg.IconUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itoolbar.UIToolbar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.menu.SeparatorDef;
import com.fr.design.menu.ToolBarDef;
import javax.swing.Icon;
import javax.swing.JPanel;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* 数据集预览-脱敏配置面板主要展示当前脱敏开启状态当前脱敏设定数量等
*
* @author Yvan
* @version 11.0
* Created by Yvan on 2022/11/14
*/
public class PreviewTableDesensitizationPane extends JPanel {
private static final String DATA_DESENSITIZATION_CONFIG = Toolkit.i18nText("Fine-Design_Report_Desensitization_Config");
private static final String LEFT_BRACKET = "(";
private static final String RIGHT_BRACKET = ")";
private static final String COUNT = Toolkit.i18nText("Fine-Design_Report_Desensitization_Count");
/**
* 预览面板
*/
private PreviewTablePane previewTablePane;
/**
* "数据脱敏设置"-标签
*/
private UILabel desensitizationLabel;
/**
* 脱敏效果预览按钮
*/
private UIToggleButton previewToggle;
public PreviewTableDesensitizationPane(PreviewTablePane previewTablePane) {
this.previewTablePane = previewTablePane;
initComponents();
}
/**
* 初始化面板
*/
private void initComponents() {
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.add(initDesensitizationLabel());
this.add(initToolBar());
this.add(initPreviewButton());
}
/**
* 初始化Label
*
* @return
*/
private Component initDesensitizationLabel() {
// 初始化Label
desensitizationLabel = new UILabel(DATA_DESENSITIZATION_CONFIG);
desensitizationLabel.setForeground(UIConstants.NORMAL_BLUE);
desensitizationLabel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
previewTablePane.clickDesensitizationLabel();
}
});
return desensitizationLabel;
}
/**
* 初始化分隔符
*
* @return
*/
private UIToolbar initToolBar() {
ToolBarDef toolbarDef = new ToolBarDef();
toolbarDef.addShortCut(SeparatorDef.DEFAULT);
UIToolbar toolBar = ToolBarDef.createJToolBar();
toolBar.setBorderPainted(false);
toolbarDef.updateToolBar(toolBar);
return toolBar;
}
/**
* 初始化脱敏效果预览按钮
*
* @return
*/
private UIToggleButton initPreviewButton() {
previewToggle = new UIToggleButton(new Icon[]{IconUtils.readIcon("/com/fr/design/images/m_file/preview"), IconUtils.readIcon("/com/fr/design/images/m_file/preview")}, true);
previewToggle.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Desensitization_Preview"));
previewToggle.setSelected(false);
previewToggle.addActionListener(e -> {
// 切换TableModel的脱敏状态
previewTablePane.togglePreviewTableModelDesensitizeStatus();
// 刷新预览页面,展示
previewTablePane.refreshTable();
});
return previewToggle;
}
public void setDesensitizationCount(boolean desensitizeOpen, int count) {
desensitizationLabel.setText(desensitizeOpen ?
DATA_DESENSITIZATION_CONFIG + LEFT_BRACKET + count + RIGHT_BRACKET + COUNT :
DATA_DESENSITIZATION_CONFIG);
}
}

7
designer-base/src/main/java/com/fr/design/env/LocalDesignerWorkspaceInfo.java vendored

@ -1,6 +1,7 @@
package com.fr.design.env;
import com.fr.general.ComparatorUtils;
import com.fr.stable.CommonUtils;
import com.fr.stable.CoreConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
@ -98,12 +99,18 @@ public class LocalDesignerWorkspaceInfo implements DesignerWorkspaceInfo {
@Override
public boolean checkValid(){
File file = new File(this.path);
//判断不是文件夹/路径不在WEB-INF下/代码启动三种情况
if(!file.isDirectory() || !ComparatorUtils.equals(file.getName(), "WEB-INF") || this.path.startsWith(".")) {
return false;
}
// 如果当前是 debug 模式,就不检测是否 mainVersion 不一致
if (CommonUtils.isDebug()) {
return true;
}
File engineLib = new File(StableUtils.pathJoin(this.path, ProjectConstants.LIB_NAME, REPORT_ENGINE_JAR));
// 非安装版本允许自由切换
boolean notExistLib = !CoreConstants.DOT.equals(StableUtils.getInstallHome())

11
designer-base/src/main/java/com/fr/design/extra/PluginUtils.java

@ -10,8 +10,8 @@ import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.PluginVerifyException;
import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalType;
import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.plugin.basic.version.VersionIntervalType;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.context.PluginMarker;
import com.fr.plugin.error.PluginBaseErrorCode;
@ -23,7 +23,7 @@ import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.JOptionPane;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@ -47,9 +47,10 @@ public class PluginUtils {
public static PluginMarker createPluginMarker(String pluginInfo) {
//todo 判空
String[] plugin = pluginInfo.split("_");
return PluginMarker.create(plugin[0], plugin[1]);
int splitIndex = pluginInfo.lastIndexOf("_");
String pluginID = pluginInfo.substring(0, splitIndex);
String version = pluginInfo.substring(splitIndex + 1);
return PluginMarker.create(pluginID, version);
}
public static JSONObject getLatestPluginInfo(String pluginID) throws Exception {

18
designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java

@ -75,7 +75,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
historyList.remove(contains(selected));
selected.getEditingFILE().closeTemplate();
FineLoggerFactory.getLogger().info(Toolkit.i18nText("Fine-Design_Basic_Template_Closed_Warn_Text", selected.getEditingFILE().getName()));
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);
MultiTemplateTabPane.getInstance().refreshOpenedTemplate(historyList);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
@ -134,10 +134,10 @@ public class HistoryTemplateListCache implements CallbackEvent {
if (contains(jt) == -1) {
addHistory();
}
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);
MultiTemplateTabPane.getInstance().refreshOpenedTemplate(historyList);
//设置tab栏为当前选中的那一栏
if (editingTemplate != null) {
MutilTempalteTabPane.getInstance().setSelectedIndex(contains(jt));
MultiTemplateTabPane.getInstance().setSelectedIndex(contains(jt));
}
}
@ -274,7 +274,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
historyList.set(i, new JVirtualTemplate(overTemplate.getEditingFILE()));
}
}
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);
MultiTemplateTabPane.getInstance().refreshOpenedTemplate(historyList);
}
@ -297,7 +297,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
int index = iterator.nextIndex();
if (size == index + 1 && index > 0) {
//如果删除的是后一个Tab,则定位到前一个
MutilTempalteTabPane.getInstance().setSelectedIndex(index - 1);
MultiTemplateTabPane.getInstance().setSelectedIndex(index - 1);
}
}
}
@ -307,13 +307,13 @@ public class HistoryTemplateListCache implements CallbackEvent {
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
}
JTemplate selectedFile = MutilTempalteTabPane.getInstance().getSelectedFile();
JTemplate selectedFile = MultiTemplateTabPane.getInstance().getSelectedFile();
if (!isCurrentEditingFile(selectedFile.getPath())) {
//如果此时面板上的实时刷新的selectedIndex得到的和历史的不一样
DesignerContext.getDesignerFrame().activateJTemplate(selectedFile);
}
MutilTempalteTabPane.getInstance().repaint();
MultiTemplateTabPane.getInstance().repaint();
}
@ -474,7 +474,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
int index = contains(this.editingTemplate);
this.editingTemplate = jt;
historyList.set(index, jt);
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(historyList);
MutilTempalteTabPane.getInstance().setSelectedIndex(contains(jt));
MultiTemplateTabPane.getInstance().refreshOpenedTemplate(historyList);
MultiTemplateTabPane.getInstance().setSelectedIndex(contains(jt));
}
}

1243
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

File diff suppressed because it is too large Load Diff

1238
designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java

File diff suppressed because it is too large Load Diff

7
designer-base/src/main/java/com/fr/design/formula/FormulaPane.java

@ -58,7 +58,7 @@ import com.fr.stable.EncodeConstants;
import com.fr.stable.EssentialUtils;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.script.CRAddress;
import com.fr.parser.CRAddress;
import com.fr.stable.script.ColumnRowRange;
import com.fr.stable.script.Expression;
import com.fr.stable.script.Node;
@ -156,6 +156,8 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private DefaultCompletionProvider completionProvider;
private static final Map<String, String> PARAM_PREFIX_MAP = new HashMap<>();
public static final int DESCRIPTION_TEXT_AREA_ROW = 16, DESCRIPTION_TEXT_AREA_COLUMN = 27;
public FormulaPane() {
initComponents();
}
@ -1194,8 +1196,7 @@ public class FormulaPane extends BasicPane implements KeyListener, UIFormula {
private void initDescriptionTextArea() {
// Description
descriptionTextArea = new UITextArea();
descriptionTextArea = new UITextArea(DESCRIPTION_TEXT_AREA_ROW,DESCRIPTION_TEXT_AREA_COLUMN);
descriptionTextArea.setBackground(Color.white);
descriptionTextArea.setLineWrap(true);
descriptionTextArea.setWrapStyleWord(true);

9
designer-base/src/main/java/com/fr/design/fun/DefaultValueAdjustProvider.java

@ -1,5 +1,6 @@
package com.fr.design.fun;
import com.fr.base.Utils;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chartx.attr.ChartProvider;
import com.fr.general.FRFont;
@ -53,4 +54,12 @@ public interface DefaultValueAdjustProvider extends Selectable {
*/
Font transformFontByResolution(FRFont font, int resolution);
/**
* 修改设计可用字体默认列表
* @return
*/
default String[] getAvailableFontFamilyNames4Report() {
return Utils.getAvailableFontFamilyNames4Report();
}
}

4
designer-base/src/main/java/com/fr/design/gui/iprogressbar/ProgressDialog.java

@ -20,6 +20,10 @@ import java.awt.Frame;
/**
* 加载进度弹窗
* <em>使用注意点:</em>
* 必须到使用时再初始化不要作为属性存在
* 因为涉及到 大小/位置 相对于 parent 的相对判断
* {@link com.fr.design.gui.iprogressbar.ProgressDialogTest}
*/
public class ProgressDialog extends UIDialog {
protected static final FRFont font = DesignUtils

9
designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java

@ -312,6 +312,15 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver
componentInitListeners();
}
/**
* 设置最大值
* @param maxValue 最大值
*/
public void setMaxValue(double maxValue) {
this.maxValue = maxValue;
textField.setMaxValue(maxValue);
}
private void componentInitListeners() {
preButton.addActionListener(new ActionListener() {
@Override

2
designer-base/src/main/java/com/fr/design/gui/itree/filetree/TemplateFileTree.java

@ -144,7 +144,7 @@ public class TemplateFileTree extends EnvFileTree {
Set<FileExtension> supportTypes = createFileExtensionFilter();
return FRContext.getFileNodes().list(
path,
supportTypes.toArray(new FileExtension[supportTypes.size()])
supportTypes.toArray(new FileExtension[supportTypes.size()]), false, true
);
}

3
designer-base/src/main/java/com/fr/design/gui/style/ComponentTitleStylePane.java

@ -12,6 +12,7 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.DesignUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle;
@ -90,7 +91,7 @@ public class ComponentTitleStylePane extends AbstractBorderPackerPane {
textContentPane = new TinyFormulaPane();
fontFamilyComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontFamilyComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
FRFont frFont = DEFAULT_TITLE_PACKER.getFrFont();
if (frFont != null) {
String fontFamily = frFont.getFamily();

3
designer-base/src/main/java/com/fr/design/gui/style/FRFontPane.java

@ -18,6 +18,7 @@ import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.DefaultValues;
@ -246,7 +247,7 @@ public class FRFontPane extends AbstractBasicStylePane implements GlobalNameObse
protected void initComponents() {
fontSizeStyleComboBox = new UIComboBox(fontSizeStyles);
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
fontNameComboBox.setPreferredSize(new Dimension(144, 20));
fontSizeComboBox = new UIComboBox(getFontSizes());
fontSizeComboBox.setEditable(true);

8
designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperlinkPane.java

@ -158,6 +158,14 @@ public class ReportletHyperlinkPane extends AbstractHyperLinkPane<ReportletHyper
protected boolean needRenamePane() {
return false;
}
public ChartNoRename(HashMap hyperLinkEditorMap, boolean needRenamePace) {
super(hyperLinkEditorMap, needRenamePace);
}
public ChartNoRename() {
super();
}
}
public ReportletHyperNorthPane getNorthPane() {

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

@ -4,7 +4,7 @@ import com.fr.design.DesignState;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuHighLight;
@ -87,7 +87,7 @@ public class CenterRegionContainerPane extends JPanel {
eastCenterPane.add(combineUp, BorderLayout.NORTH);
templateTabPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
templateTabPane.add(newWorkBookPane = getToolBarMenuDock().getNewTemplatePane(), BorderLayout.WEST);
templateTabPane.add(MutilTempalteTabPane.getInstance(), BorderLayout.CENTER);
templateTabPane.add(MultiTemplateTabPane.getInstance(), BorderLayout.CENTER);
eastCenterPane.add(templateTabPane, BorderLayout.CENTER);
eastPane.add(eastCenterPane, BorderLayout.CENTER);

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

@ -21,7 +21,7 @@ import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.file.SaveSomeTemplatePane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.OemProcessor;
@ -1110,7 +1110,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
// 新的form不往前兼容
if (inValidDesigner(jt)) {
this.addAndActivateJTemplate();
MutilTempalteTabPane.getInstance().setTemTemplate(
MultiTemplateTabPane.getInstance().setTemTemplate(
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate());
} else {
this.addAndActivateJTemplate(jt);

10
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -21,7 +21,7 @@ import com.fr.design.file.FileOperations;
import com.fr.design.file.FileToolbarStateChangeListener;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
@ -275,7 +275,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());
HistoryTemplateListPane.getInstance().setCurrentEditingTemplate(jt);
//处理自动新建的模板
MutilTempalteTabPane.getInstance().doWithtemTemplate();
MultiTemplateTabPane.getInstance().doWithtemTemplate();
if (DesignerMode.isAuthorityEditing()) {
RolesAlreadyEditedPane.getInstance().refreshDockingView();
}
@ -547,10 +547,10 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
for (JTemplate jTemplate : HistoryTemplateListCache.getInstance().getHistoryList()) {
if (ComparatorUtils.equals(jTemplate.getEditingFILE().getPath(), path)) {
if (isCurrentEditing) {
MutilTempalteTabPane.getInstance().setIsCloseCurrent(true);
MultiTemplateTabPane.getInstance().setIsCloseCurrent(true);
}
MutilTempalteTabPane.getInstance().closeFormat(jTemplate);
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jTemplate);
MultiTemplateTabPane.getInstance().closeFormat(jTemplate);
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(jTemplate);
return;
}
}

10
designer-base/src/main/java/com/fr/design/mainframe/JNullTemplate.java

@ -204,4 +204,14 @@ public class JNullTemplate extends JTemplate {
public int getToolBarHeight() {
return 0;
}
@Override
public String getPath() {
return null;
}
@Override
public void refreshToolArea() {
DesignerContext.getDesignerFrame().resetToolkitByPlus(this);
}
}

2
designer-base/src/main/java/com/fr/design/mainframe/loghandler/DesignerLogHandler.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe.loghandler;
import com.finebi.cbb.base.tuple.Pair;
import com.fr.stable.collections.combination.Pair;
import com.fr.base.BaseUtils;
import com.fr.base.TRL;
import com.fr.design.file.HistoryTemplateListCache;

5
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/SidebarMobileBookMarkStyleCustomDefinePane.java

@ -17,6 +17,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
import com.fr.form.ui.mobile.impl.SidebarMobileBookMarkStyle;
@ -161,7 +162,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderLineStyle());
normalBorderColorBox = new ColorSelectBox(COLUMN_WIDTH);
normalBorderColorBox.setSelectObject(DEFAULT_STYLE.getBorderColor());
normalFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
normalFontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
normalFontNameComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontFamily());
normalFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
normalFontSizeComboBox.setSelectedItem(DEFAULT_STYLE.getFontSize());
@ -248,7 +249,7 @@ public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<Mo
selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderLineStyle());
selectedBorderColorBox = new ColorSelectBox(COLUMN_WIDTH);
selectedBorderColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBorderColor());
selectedFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
selectedFontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
selectedFontNameComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontFamily());
selectedFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
selectedFontSizeComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontSize());

46
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/topparam/MobileTopParamPane.java

@ -2,15 +2,31 @@ package com.fr.design.mainframe.mobile.ui.topparam;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.form.ui.mobile.impl.MobileTopParamStyle;
import javax.swing.*;
import java.awt.*;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class MobileTopParamPane extends BasicBeanPane<MobileTopParamStyle> {
private UICheckBox autoCommitCheckBox;
private UISpinner maxDirectShowCountSpinner;
private UILabel showCountTextField;
private static final int MAX_VALUE_AUTO = 4;
private static final int MAX_VALUE = 3;
private static final int MIN_VALUE = 1;
private static final int DEFAULT_DIERTA = 1;
private static final int DEFAULT_VALUE = 4;
private static final int GAP = 2;
public MobileTopParamPane() {
this.init();
@ -21,19 +37,43 @@ public class MobileTopParamPane extends BasicBeanPane<MobileTopParamStyle> {
JPanel panel = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Plugin-TopParam_Setting"));
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
autoCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Plugin-TopParam_AutoCommit"), true);
panel.add(autoCommitCheckBox);
maxDirectShowCountSpinner = new UISpinner(MIN_VALUE, MAX_VALUE_AUTO, DEFAULT_DIERTA, DEFAULT_VALUE);
showCountTextField = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Widget_Show_Count"));
Component[][] components = {{autoCommitCheckBox},{showCountTextField, maxDirectShowCountSpinner}};
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
JPanel paraPane = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, GAP);
panel.add(paraPane);
this.add(panel, BorderLayout.CENTER);
autoCommitCheckBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!autoCommitCheckBox.isSelected()) {
maxDirectShowCountSpinner.setMaxValue(MAX_VALUE);
if (maxDirectShowCountSpinner.getValue() >= MAX_VALUE_AUTO) {
maxDirectShowCountSpinner.setValue(MAX_VALUE);
}
} else {
maxDirectShowCountSpinner.setMaxValue(MAX_VALUE_AUTO);
}
}
});
}
@Override
public void populateBean(MobileTopParamStyle topParamStyle) {
autoCommitCheckBox.setSelected(topParamStyle.isAutoCommit());
maxDirectShowCountSpinner.setValue(topParamStyle.getMaxDirectShowCount());
}
@Override
public MobileTopParamStyle updateBean() {
MobileTopParamStyle topParamStyle = new MobileTopParamStyle();
topParamStyle.setAutoCommit(autoCommitCheckBox.isSelected());
topParamStyle.setMaxDirectShowCount((int) maxDirectShowCountSpinner.getValue());
return topParamStyle;
}

3
designer-base/src/main/java/com/fr/design/mainframe/mobile/utils/FontConfigPane.java

@ -5,6 +5,7 @@ import com.fr.base.Utils;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont;
import javax.swing.*;
@ -35,7 +36,7 @@ public class FontConfigPane extends JPanel {
private void init() {
this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
fontFamily = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontFamily = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
Vector<Integer> integerList = new Vector<>();
for (int i = 1; i < 100; i++) {
integerList.add(i);

3
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/chart/ChartFontPane.java

@ -13,6 +13,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
@ -52,7 +53,7 @@ public class ChartFontPane extends BasicPane {
}
private void initState() {
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
fontSizeComboBox = new UIComboBox(FONT_SIZES);
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));

8
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionCellEditor.java

@ -1,7 +1,7 @@
package com.fr.design.mainframe.vcs.ui;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.mainframe.JTemplate;
@ -57,9 +57,9 @@ public class FileVersionCellEditor extends AbstractCellEditor implements TableCe
jt.stopEditing();
//只有模板路径一致时关闭当前模板
if (ComparatorUtils.equals(fileOfVersion, jt.getPath())) {
MutilTempalteTabPane.getInstance().setIsCloseCurrent(true);
MutilTempalteTabPane.getInstance().closeFormat(jt);
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt);
MultiTemplateTabPane.getInstance().setIsCloseCurrent(true);
MultiTemplateTabPane.getInstance().closeFormat(jt);
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(jt);
}
//再打开cache中的模板

8
designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java

@ -5,7 +5,7 @@ import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.base.mode.DesignerMode;
import com.fr.design.dialog.BasicPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
@ -115,9 +115,9 @@ public class FileVersionsPanel extends BasicPane {
// 关闭当前打开的版本
JTemplate<?, ?> jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
MutilTempalteTabPane.getInstance().setIsCloseCurrent(true);
MutilTempalteTabPane.getInstance().closeFormat(jt);
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt);
MultiTemplateTabPane.getInstance().setIsCloseCurrent(true);
MultiTemplateTabPane.getInstance().closeFormat(jt);
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(jt);
updateDesignerFrame(true);

3
designer-base/src/main/java/com/fr/design/mainframe/widget/MobileTabFontConfPane.java

@ -5,6 +5,7 @@ import com.fr.base.Utils;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont;
import javax.swing.Icon;
@ -38,7 +39,7 @@ public class MobileTabFontConfPane extends JPanel {
private void init() {
this.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
fontFamily = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontFamily = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
Vector<Integer> integerList = new Vector<Integer>();
for (int i = 1; i < 100; i++) {
integerList.add(i);

3
designer-base/src/main/java/com/fr/design/style/FontFamilyPane.java

@ -3,6 +3,7 @@ package com.fr.design.style;
import com.fr.base.Utils;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
@ -26,7 +27,7 @@ public class FontFamilyPane extends JPanel {
familyField = new UITextField();
familyField.setEditable(false);
familyList = new JList(Utils.getAvailableFontFamilyNames4Report());
familyList = new JList(DesignUtils.getAvailableFontFamilyNames4Report());
familyList.setVisibleRowCount(4);
familyList.addListSelectionListener(listener);

13
designer-base/src/main/java/com/fr/design/utils/DesignUtils.java

@ -2,6 +2,7 @@ package com.fr.design.utils;
import com.fr.base.FeedBackInfo;
import com.fr.base.ServerConfig;
import com.fr.base.Utils;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
@ -481,4 +482,16 @@ public class DesignUtils {
return null;
}
/**
* 获取设计器可用字体
* @return
*/
public static String[] getAvailableFontFamilyNames4Report() {
DefaultValueAdjustProvider valueAdjust = DesignUtils.getValueAdjust();
if (valueAdjust != null) {
return valueAdjust.getAvailableFontFamilyNames4Report();
}
return Utils.getAvailableFontFamilyNames4Report();
}
}

4
designer-base/src/main/java/com/fr/design/worker/open/OpenWorker.java

@ -3,7 +3,7 @@ package com.fr.design.worker.open;
import com.fr.base.chart.exception.ChartNotFoundException;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.lock.LockInfoDialog;
@ -87,7 +87,7 @@ public class OpenWorker<T> extends SwingWorker<T, Void> {
UIManager.getIcon("OptionPane.errorIcon"));
}
if (cause.getCause() instanceof TplLockedException) {
MutilTempalteTabPane.getInstance().closeCurrentTpl();
MultiTemplateTabPane.getInstance().closeCurrentTpl();
TemplateTreePane.getInstance().getFileNode().setLock(UUID.randomUUID().toString());
LockInfoDialog.show(null);
}

8
designer-base/src/main/java/com/fr/nx/app/designer/toolbar/TemplateTransformer.java

@ -2,7 +2,7 @@ package com.fr.nx.app.designer.toolbar;
import com.fr.base.extension.FileExtension;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.file.FILE;
@ -103,9 +103,9 @@ public enum TemplateTransformer {
DesignerContext.getDesignerFrame().openTemplate(file);
return;
}
MutilTempalteTabPane.getInstance().setIsCloseCurrent(true);
MutilTempalteTabPane.getInstance().closeFormat(jt);
MutilTempalteTabPane.getInstance().closeSpecifiedTemplate(jt);
MultiTemplateTabPane.getInstance().setIsCloseCurrent(true);
MultiTemplateTabPane.getInstance().closeFormat(jt);
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(jt);
DesignerContext.getDesignerFrame().openTemplate(file);
}

9
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -8,7 +8,7 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.constants.DesignerLaunchStatus;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.fun.impl.DesignerStartWithEmptyFile;
@ -39,6 +39,7 @@ import org.jetbrains.annotations.Nullable;
import java.awt.Window;
import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@ -136,7 +137,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
DesignerFrame df = DesignerContext.getDesignerFrame();
isException = openFile(df, isException, file);
df.fireDesignerOpened();
FineLoggerFactory.getLogger().debug("show designer cost {} ms", DesignerStartupContext.getRecorder().getTime());
FineLoggerFactory.getLogger().info("Designer showed.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS));
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
if (!isException) {
@ -192,7 +193,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
} else {
df.addAndActivateJTemplate();
// 如果没有模板,则需要确认一下
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
MultiTemplateTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
}
@ -252,7 +253,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
private boolean createNewTemplate(DesignerFrame df) {
df.addAndActivateJTemplate();
// 如果没有模板,则需要确认一下
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
MultiTemplateTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
return true;
}

4
designer-base/src/main/java/com/fr/start/common/DesignerOpenEmptyPanel.java

@ -3,7 +3,7 @@ package com.fr.start.common;
import com.fr.base.svg.IconUtils;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
@ -59,7 +59,7 @@ public class DesignerOpenEmptyPanel extends JPanel {
HistoryTemplateListCache.getInstance().setCurrentEditingTemplate(null);
df.addAndActivateJTemplate();
// 如果没有模板,则需要确认一下
MutilTempalteTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
MultiTemplateTabPane.getInstance().setTemTemplate(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
}
});
createButton.setBorder(new EmptyBorder(0, 10, 0, 10));

21
designer-base/src/main/java/com/fr/start/common/DesignerStartupPool.java

@ -4,17 +4,36 @@ import com.fr.concurrent.FineExecutors;
import com.fr.concurrent.NamedThreadFactory;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
/**
* created by Harrison on 2022/07/03
**/
public class DesignerStartupPool {
private static final Executor COMMON_EXECUTOR = FineExecutors.newCachedThreadPool(new NamedThreadFactory("startup-common"));
private static final int MAX_THREAD_COUNT = Runtime.getRuntime().availableProcessors() * 2;
private static final Executor COMMON_EXECUTOR = FineExecutors.newThreadPoolExecutor(MAX_THREAD_COUNT, MAX_THREAD_COUNT, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory("startup-common"));
private static final Executor DESIGNER_EXECUTOR = FineExecutors.newThreadPoolExecutor(MAX_THREAD_COUNT, MAX_THREAD_COUNT, 10L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory("startup-designer"));
/**
*
* @return 启动通用线程池
*/
public static Executor common() {
return COMMON_EXECUTOR;
}
/**
*
* @return 启动设计器线程池
*/
public static Executor designer() {
return DESIGNER_EXECUTOR;
}
}

118
designer-base/src/main/java/com/fr/startup/ui/StartupLoadingPanel.java

@ -0,0 +1,118 @@
package com.fr.startup.ui;
import com.fr.concurrent.FineExecutors;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.gui.iprogressbar.ProgressDialog;
import com.fr.design.i18n.Toolkit;
import com.fr.design.ui.util.UIUtil;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.module.ModuleEvent;
import java.awt.Frame;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/**
* 启动加载面板
*
* @author Harrison
* @version 11.0
* created by Harrison on 2022/11/08
**/
public class StartupLoadingPanel {
/**
* 每次更新的步伐
*/
private static final int STEP = 1;
/**
* 40ms更新进度
*/
private static final int STEP_HEARTBEAT = 40;
private final Listener<String> MODULE_LISTENER = new Listener<String>() {
@Override
public void on(Event event, String param) {
moduleId = param;
}
};
private ProgressDialog progressDialog;
private String moduleId;
private int progress;
public StartupLoadingPanel(Frame frame) {
this.progressDialog = new ProgressDialog(frame);
this.moduleId = Toolkit.i18nText("Fine-Design_Basic_Initializing");
initListeners();
}
/**
* 隐藏
*/
public void hide() {
this.progress = progressDialog.getProgressMaximum();
}
/**
* 展示
*/
public void show() {
final ScheduledExecutorService scheduler = FineExecutors.newScheduledThreadPool(1,
new NamedThreadFactory("StartupLoadingPanel"));
scheduler.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
UIUtil.invokeAndWaitIfNeeded(() -> {
if (isComplete()) {
scheduler.shutdown();
progressDialog.dispose();
resetListeners();
return;
}
if (!progressDialog.isVisible()) {
progressDialog.setVisible(true);
String moduleId = getModuleId();
progressDialog.updateLoadingText(moduleId);
}
progressDialog.setProgressValue(incrementProgress());
});
}
}, 0, STEP_HEARTBEAT, TimeUnit.MILLISECONDS);
}
private void initListeners() {
EventDispatcher.listen(ModuleEvent.MajorModuleStarting, MODULE_LISTENER);
}
private void resetListeners() {
EventDispatcher.stopListen(MODULE_LISTENER);
}
private boolean isComplete() {
return this.progress >= progressDialog.getProgressMaximum();
}
private String getModuleId() {
return this.moduleId;
}
private int incrementProgress() {
if (progress != progressDialog.getProgressMaximum()) {
progress += STEP;
}
return progress;
}
}

146
designer-base/src/main/java/com/fr/startup/ui/StartupPageWindow.java

@ -2,7 +2,6 @@ package com.fr.startup.ui;
import com.fr.base.svg.IconUtils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.components.loading.LoadingPane;
import com.fr.design.dialog.UIExpandDialog;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
@ -12,12 +11,14 @@ import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.ColorUtils;
import com.fr.design.utils.ThemeUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.exit.DesignerExiter;
import com.fr.general.GeneralUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.ProductConstants;
import com.fr.stable.collections.CollectionUtils;
import com.fr.stable.os.OperatingSystem;
import com.fr.start.common.DesignerStartupContext;
import com.fr.startup.metric.DesignerMetrics;
import org.jetbrains.annotations.NotNull;
@ -25,7 +26,6 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.ScrollPaneConstants;
@ -34,7 +34,6 @@ import javax.swing.SwingWorker;
import javax.swing.border.EmptyBorder;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
@ -59,9 +58,6 @@ import java.util.Map;
**/
public class StartupPageWindow extends JFrame {
private static final int CONTENT_LAYER = 0;
private static final int TRANSPARENT_LAYER = 1;
private static final Color HOVER_COLOR = new Color(65, 155, 249);
private static final Color SEP_COLOR = new Color(224, 224, 225);
@ -84,56 +80,51 @@ public class StartupPageWindow extends JFrame {
private JPanel body;
private LoadingPane loadingPane = new LoadingPane();
private JLayeredPane layeredPane = new JLayeredPane() {
@Override
public void doLayout() {
for (Component comp : getComponents()) {
comp.setBounds(0, 0, getWidth(), getHeight());
}
}
};
public StartupPageWindow(StartupPageModel pageModel) {
patchUIAction(pageModel);
setLayout(new BorderLayout());
this.body = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.body.setBackground(new Color(0, 0, 0, 0));
// Header
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Select_Workspace"));
Font font = label.getFont();
Font titleFont = font.deriveFont(font.getStyle(), TITLE_FONT_SIZE);
label.setFont(titleFont);
JPanel headerPanel = new JPanel();
LayoutManager centerFlowLayout = FRGUIPaneFactory.createCenterFlowLayout();
headerPanel.setLayout(centerFlowLayout);
headerPanel.add(label);
headerPanel.setBackground(new Color(0, 0, 0, 0));
this.body.add(headerPanel, BorderLayout.NORTH);
// Workspace-description
this.workspacePanel = generateWorkspacePanel(pageModel);
this.body.add(workspacePanel, BorderLayout.CENTER);
initCenter(pageModel);
workspacePanel.setSelectWorkspaceRunnable(new Runnable() {
@Override
public void run() {
JPanel newPanel = generateRecentOpenPanel(pageModel);
// Workspace-detail
setSize(SCREEN_SIZE);
setDefaultTitle();
addDefaultListeners();
body.remove(recentOpenPanel);
recentOpenPanel = newPanel;
body.add(recentOpenPanel, BorderLayout.SOUTH);
validate();
repaint();
validate();
revalidate();
setFullScreen();
}
private void initCenter(StartupPageModel pageModel) {
initHeaderPanel();
initWorkspacePanel(pageModel);
initRecentOpenPanel(pageModel);
initContentPanel();
}
});
private void initHeaderPanel() {
this.body = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.body.setBackground(new Color(0, 0, 0, 0));
JPanel headerPanel = createHeader();
this.body.add(headerPanel, BorderLayout.NORTH);
}
private void initRecentOpenPanel(StartupPageModel pageModel) {
this.recentOpenPanel = generateRecentOpenPanel(pageModel);
this.body.add(recentOpenPanel, BorderLayout.SOUTH);
}
private void initContentPanel() {
this.contentPane = new JPanel() {
@Override
protected void paintComponent(Graphics g) {
@ -145,31 +136,57 @@ public class StartupPageWindow extends JFrame {
this.contentPane.add(this.body, BorderLayout.CENTER);
this.contentPane.setPreferredSize(this.body.getPreferredSize());
this.layeredPane.setName("layered-pane");
this.layeredPane.add(this.contentPane, CONTENT_LAYER);
this.layeredPane.add(this.loadingPane, TRANSPARENT_LAYER);
this.layeredPane.moveToFront(this.contentPane);
add(this.contentPane, BorderLayout.CENTER);
}
add(this.layeredPane, BorderLayout.CENTER);
private void initWorkspacePanel(StartupPageModel pageModel) {
// Workspace-detail
setSize(SCREEN_SIZE);
setDefaultTitle();
addDefaultListeners();
// Workspace-description
this.workspacePanel = generateWorkspacePanel(pageModel);
this.body.add(workspacePanel, BorderLayout.CENTER);
repaint();
workspacePanel.setSelectWorkspaceRunnable(new Runnable() {
@Override
public void run() {
JPanel newPanel = generateRecentOpenPanel(pageModel);
body.remove(recentOpenPanel);
recentOpenPanel = newPanel;
body.add(recentOpenPanel, BorderLayout.SOUTH);
validate();
revalidate();
repaint();
}
});
}
setFullScreen();
@NotNull
private static JPanel createHeader() {
// Header
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Startup_Page_Select_Workspace"));
Font font = label.getFont();
Font titleFont = font.deriveFont(font.getStyle(), TITLE_FONT_SIZE);
label.setFont(titleFont);
JPanel headerPanel = new JPanel();
LayoutManager centerFlowLayout = FRGUIPaneFactory.createCenterFlowLayout();
headerPanel.setLayout(centerFlowLayout);
headerPanel.add(label);
headerPanel.setBackground(new Color(0, 0, 0, 0));
return headerPanel;
}
/**
* 1-mac启动时全屏
* 2-windows 则居中处理
*/
private void setFullScreen() {
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
if (OperatingSystem.isMacos()) {
this.setLocation(0, 0);
this.setSize(screenSize.width, screenSize.height);
this.setSize(SCREEN_SIZE.width, SCREEN_SIZE.height);
} else {
GUICoreUtils.setWindowFullScreen(this);
}
}
private void addDefaultListeners() {
@ -215,8 +232,14 @@ public class StartupPageWindow extends JFrame {
private void enterWorkspace(Runnable action) {
loadingPane.start();
layeredPane.moveToFront(loadingPane);
UIUtil.invokeAndWaitIfNeeded(() -> {
// 必须直接初始化
// 见 https://work.fineres.com/browse/REPORT-85293
StartupLoadingPanel loadingPanel = new StartupLoadingPanel(this);
loadingPanel.show();
setEnabled(false);
SwingWorker<Void, Void> task = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
@ -243,15 +266,16 @@ public class StartupPageWindow extends JFrame {
.modal(false)
.build()
.setVisible(true);
setEnabled(true);
});
FineLoggerFactory.getLogger().error(e.getMessage(), e);
layeredPane.moveToFront(contentPane);
} finally {
loadingPane.stop();
loadingPanel.hide();
}
}
};
task.execute();
});
}
private JPanel generateRecentOpenPanel(StartupPageModel pageModel) {

55
designer-base/src/test/java/com/fr/design/gui/iprogressbar/ProgressDialogTest.java

@ -0,0 +1,55 @@
package com.fr.design.gui.iprogressbar;
import com.fr.design.utils.DevUtils;
import java.awt.Dimension;
import java.awt.Frame;
import java.util.function.Consumer;
/**
* @author Harrison
* @version 11.0
* Created by Harrison on 2022/11/23
*/
public class ProgressDialogTest {
public static void main(String[] args) {
mockInitSize();
}
/**
* 模拟 frame 的大小未初始化好的情况
*/
private static void mockNotInitSize() {
DevUtils.show(new Consumer<Frame>() {
@Override
public void accept(Frame frame) {
Dimension origin = frame.getSize();
frame.setSize(0, 0);
ProgressDialog progressDialog = new ProgressDialog(frame);
progressDialog.setVisible(true);
progressDialog.updateLoadingText("test");
frame.setSize(origin);
}
});
}
/**
* 模拟 frame 的大小初始化好的情况
*/
private static void mockInitSize() {
DevUtils.show(new Consumer<Frame>() {
@Override
public void accept(Frame frame) {
ProgressDialog progressDialog = new ProgressDialog(frame);
progressDialog.setVisible(true);
progressDialog.updateLoadingText("test");
}
});
}
}

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

@ -18,6 +18,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.AlphaPane;
import com.fr.design.style.FRFontPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
@ -114,7 +115,7 @@ public class ChartAlertValuePane extends BasicBeanPane<ChartAlertValue> {
fontNameBox.setPreferredSize(new Dimension(80,20));
fontNameBox.addItem("SimSun"); // TODO 这边字体中没有在列表内
String[] names = Utils.getAvailableFontFamilyNames4Report();
String[] names = DesignUtils.getAvailableFontFamilyNames4Report();
for(int i = 0; i < names.length; i++) {
fontNameBox.addItem(names[i]);
}

3
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/DataLabelStylePane.java

@ -9,6 +9,7 @@ import com.fr.chart.base.TextAttr;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont;
import com.fr.design.style.FRFontPane;
@ -36,7 +37,7 @@ public class DataLabelStylePane extends BasicPane {
private void initPane(boolean isSurpportFontColor) {
this.setLayout(FRGUIPaneFactory.createBoxFlowLayout());
this.add(nameBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()));
this.add(nameBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()));
nameBox.setPreferredSize(new Dimension(80, 20));
String[] styles = {

7
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java

@ -23,13 +23,13 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2018/9/12.
@ -93,12 +93,13 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends BasicBeanPane<T
public void clearAllBoxList() {
useFieldValuePane.clearAllBoxList();
customFieldNamePane.clearAllBoxList();
fieldList.clear();
}
public void refreshBoxListWithSelectTableData(List columnNameList) {
useFieldValuePane.refreshBoxListWithSelectTableData(columnNameList);
fieldList = columnNameList;
fieldList = new ArrayList<>(columnNameList);
}
private void checkCardPane() {

10
designer-chart/src/main/java/com/fr/design/chartx/component/correlation/AbstractCorrelationPane.java

@ -127,4 +127,14 @@ public abstract class AbstractCorrelationPane<T> extends BasicBeanPane<T> {
return StringUtils.EMPTY;
}
/**
* 清空 系列名使用字段名 表格
*/
public void clearAllBoxList() {
this.correlationPane.getTable().clear();
this.correlationPane.validate();
this.correlationPane.repaint();
this.correlationPane.revalidate();
}
}

5
designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java

@ -8,6 +8,7 @@ import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane;
import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import java.awt.BorderLayout;
@ -75,6 +76,10 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
List<String> columnNameList = dataWrap.calculateColumnNameList();
if (dataSetFieldsPane != null) {
// 如果属性编辑画板中选中的数据集发生改变,则清空之前的匹配项
if (!StringUtils.equals(dataSetFieldsPane.getTableName(), dataWrap.getTableDataName())) {
dataSetFieldsPane.clearAllBoxList();
}
dataSetFieldsPane.refreshBoxListWithSelectTableData(columnNameList);
dataSetFieldsPane.setTableName(dataWrap.getTableDataName());
}

10
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java

@ -24,8 +24,6 @@ import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.event.ChangeEvent;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
@ -33,6 +31,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* 属性表 数据集界面: 系列名 使用字段名.
@ -145,7 +145,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
* @param list 数据集
*/
public void refreshBoxListWithSelectTableData(List list) {
field.clear();
clearAllBoxList();
for (int i = 0, length = list.size(); i < length; i++) {
Object ob = list.get(i);
@ -160,6 +160,10 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
*/
public void clearAllBoxList(){
field.clear();
seriesDataPane.getTable().clear();
seriesDataPane.validate();
seriesDataPane.repaint();
seriesDataPane.revalidate();
}
private void fireStop() {

3
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ChartTextAttrPane.java

@ -14,6 +14,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.mode.ChartEditContext;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
@ -190,7 +191,7 @@ public class ChartTextAttrPane extends BasicPane {
}
protected void initState() {
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
fontSizeComboBox = new UIComboBox(getFontSizeComboBoxModel());
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));

8
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/ColorPickerPaneNumFiled.java

@ -6,6 +6,7 @@ import com.fr.module.ModuleContext;
import com.fr.value.ClearableLazyValue;
import org.jetbrains.annotations.NotNull;
import javax.swing.SwingUtilities;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@ -32,12 +33,9 @@ public class ColorPickerPaneNumFiled extends UINumberField {
@Override
protected void attributeChange() {
ses.getValue().schedule(new Runnable() {
@Override
public void run() {
ses.getValue().schedule(() -> {
// kuns: 默认修改500, 在地图修改系列颜色text时, 快速响应.
runChange();
}
SwingUtilities.invokeLater(this::runChange);
}, 500, TimeUnit.MILLISECONDS);
}

3
designer-chart/src/main/java/com/fr/van/chart/designer/style/background/VanChartAlertValuePane.java

@ -17,6 +17,7 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
@ -99,7 +100,7 @@ public class VanChartAlertValuePane extends BasicBeanPane<VanChartAlertValue> {
alertText.setPreferredSize(new Dimension(TEXT_WD, HT));
fontSize = new UIComboBox(FRFontPane.FONT_SIZES);
fontName = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontName = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
fontColor = new ColorSelectBox(100);
}

11
designer-chart/src/main/java/com/fr/van/chart/multilayer/data/MultiPiePlotTableDataContentPane.java

@ -10,6 +10,7 @@ import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
@ -17,7 +18,6 @@ import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.multilayer.data.MultiPieValueDefinition;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.ArrayUtils;
import com.fr.stable.AssistUtils;
import com.fr.stable.StringUtils;
@ -235,7 +235,14 @@ public class MultiPiePlotTableDataContentPane extends AbstractTableDataContentPa
@Override
public void clearAllBoxList() {
levelNumEdit.setValue(3);
nameField.setText(StringUtils.EMPTY);
clearBoxItems(value);
for (UIComboBox uiComboBox : levelNameList) {
clearBoxItems(uiComboBox);
}
clearBoxItems(calculateCombox);
refreshCenterPane();
}
@Override

3
designer-chart/src/main/java/com/fr/van/chart/wordcloud/designer/style/VanChartWordCloudSeriesPane.java

@ -14,6 +14,7 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.FRFont;
import com.fr.general.IOUtils;
@ -94,7 +95,7 @@ public class VanChartWordCloudSeriesPane extends VanChartColorValueSeriesPane {
double[] northC = {f, e};
double[] northR = {p, p};
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
defineFontSize = new UIButtonGroup(new String[]{AUTO_FONT_SIZE, CUSTOM_FONT_SIZE});
Component[][] northComps = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font")), fontNameComboBox},

4
designer-form/src/main/java/com/fr/design/fit/common/TemplateTool.java

@ -1,7 +1,7 @@
package com.fr.design.fit.common;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.fit.NewJForm;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
@ -86,7 +86,7 @@ public class TemplateTool {
JTemplate oldJTemplate = jTemplateList.get(i);
if (oldJTemplate != null && ComparatorUtils.equals(oldJTemplate.getEditingFILE(), newJTemplate.getEditingFILE())) {
jTemplateList.set(i, newJTemplate);
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(jTemplateList);
MultiTemplateTabPane.getInstance().refreshOpenedTemplate(jTemplateList);
return;
}
}

3
designer-form/src/main/java/com/fr/design/gui/xpane/CardTagLayoutBorderPane.java

@ -12,6 +12,7 @@ import com.fr.design.gui.style.FRFontPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.LayoutBorderStyle;
@ -32,7 +33,7 @@ public class CardTagLayoutBorderPane extends LayoutBorderPane {
protected UIScrollPane initRightBottomPane(){
this.setFontSizeComboBox(new UIComboBox(FRFontPane.FONT_SIZES));
this.setFontNameComboBox(new UIComboBox(Utils.getAvailableFontFamilyNames4Report()));
this.setFontNameComboBox(new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report()));
JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0));
fontSizeTypePane.add(this.getFontSizeComboBox(), BorderLayout.CENTER);
fontSizeTypePane.add(this.getFontNameComboBox(), BorderLayout.EAST);

3
designer-form/src/main/java/com/fr/design/gui/xpane/LayoutBorderPane.java

@ -33,6 +33,7 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.mainframe.JForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.LayoutBorderStyle;
import com.fr.form.ui.WidgetTitle;
@ -437,7 +438,7 @@ public class LayoutBorderPane extends BasicPane {
protected UIScrollPane initRightBottomPane(){
formulaPane = new TinyFormulaPane();
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES);
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
fontNameComboBox.setPreferredSize(new Dimension(160, 30));
JPanel fontSizeTypePane = new JPanel(new BorderLayout(10,0));
fontSizeTypePane.add(fontSizeComboBox, BorderLayout.CENTER);

4
designer-form/src/main/java/com/fr/design/preview/DeveloperPreview.java

@ -1,7 +1,7 @@
package com.fr.design.preview;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.fun.impl.AbstractPreviewProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JForm;
@ -66,7 +66,7 @@ public class DeveloperPreview extends AbstractPreviewProvider {
}
private void onPreview(JTemplate<?, ?> jt) {
MutilTempalteTabPane.getInstance().closeCurrentTpl();
MultiTemplateTabPane.getInstance().closeCurrentTpl();
jt.generateForBiddenTemplate();
}

3
designer-realize/src/main/java/com/fr/design/actions/cell/style/ReportFontNameAction.java

@ -3,6 +3,7 @@
*/
package com.fr.design.actions.cell.style;
import com.fr.design.utils.DesignUtils;
import com.fr.stable.os.OperatingSystem;
import java.awt.Dimension;
@ -80,7 +81,7 @@ public class ReportFontNameAction extends AbstractStyleAction {
public JComponent createToolBarComponent() {
Object object = this.getValue(UIComboBox.class.getName());
if (object == null || !(object instanceof UIComboBox)) {
UIComboBox itemComponent = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
UIComboBox itemComponent = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
this.putValue(UIComboBox.class.getName(), itemComponent);
//设置最佳宽度.
itemComponent.setPreferredSize(new Dimension(

2
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceSouthPanel.java

@ -29,7 +29,7 @@ public class ITReplaceSouthPanel {
RowSorter<ITTableEditor> sorter = new TableRowSorter<ITTableEditor>(itTableEditor) {
@Override
public boolean isSortable(int column) {
return column != CHECKBOX_INDEX || column != CONTENT_INDEX;
return column != CHECKBOX_INDEX && column != CONTENT_INDEX;
}
};
tableEditorPane.getEditTable().setRowSorter(sorter);

33
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceWestPanel.java

@ -14,11 +14,11 @@ import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.util.List;
@ -49,31 +49,28 @@ public class ITReplaceWestPanel {
contentButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Basic_Templates_Content"));
settingButton = new UIToggleButton(Toolkit.i18nText("Fine-Design_Replace_Setting"));
contentButton.setText(CONTENT_TEXT);
contentButton.addActionListener(new ActionListener() {
contentButton.addChangeListener(new ChangeListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!contentButton.isSelected()) {
public void stateChanged(ChangeEvent e) {
if (contentButton.isSelected()) {
showSelectPanel(ITReplaceNorthPanel.CARD_CONTENT, ITReplaceMainDialog.getSearchContentResultList());
settingButton.setSelected(!contentButton.isSelected());
changeColor4SelectContent();
} else {
showSelectPanel(ITReplaceNorthPanel.CARD_SETTING, ITReplaceMainDialog.getSearchSettingResultList());
contentButton.setSelected(true);
}
changeColor4SelectContent();
settingButton.setSelected(contentButton.isSelected());
}
});
settingButton.addActionListener(new ActionListener() {
settingButton.addChangeListener(new ChangeListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!settingButton.isSelected()) {
public void stateChanged(ChangeEvent e) {
if (settingButton.isSelected()) {
showSelectPanel(ITReplaceNorthPanel.CARD_SETTING, ITReplaceMainDialog.getSearchSettingResultList());
contentButton.setSelected(!settingButton.isSelected());
changeColor4SelectContent();
} else {
showSelectPanel(ITReplaceNorthPanel.CARD_CONTENT, ITReplaceMainDialog.getSearchContentResultList());
settingButton.setSelected(true);
}
changeColor4SelectContent();
contentButton.setSelected(settingButton.isSelected());
}
});
leftPanel.setBackground(Color.WHITE);
@ -118,7 +115,7 @@ public class ITReplaceWestPanel {
* 切换面板时改变颜色
*/
public void changeColor4SelectContent() {
if (!contentButton.isSelected()) {
if (contentButton.isSelected()) {
contentButton.setText(CONTENT_TEXT);
settingButton.setText(Toolkit.i18nText("Fine-Design_Replace_Setting"));
} else {

13
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableButton.java

@ -38,19 +38,6 @@ public class ITTableButton extends AbstractCellEditor implements TableCellEditor
paraButton = new UIButton("<html><font color = 'rgb(61,153,249)'>" + Toolkit.i18nText("Fine-Design_Chart_Location") + "</font> ");
paraButton.setVisible(true);
paraButton.setBorderPainted(false);
paraButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ITContent content = (ITContent) getEditTable().getValueAt(getEditTable().getEditingRow(), ITReplaceSouthPanel.CONTENT_INDEX);
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true);
TRL trl = new TRL(GeneralUtils.objectToString(content.getTrlString()));
DesignerContext.getDesignerFrame().openOrActiveTemplate(content.getTemplatePath());
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(trl);
}
ITReplaceMainDialog.setITReplaceFlag(false);
}
});
}

2
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditor.java

@ -94,7 +94,7 @@ public class ITTableEditor extends UITableModelAdapter {
*/
@Override
public boolean isCellEditable(int row, int col) {
return col == ITReplaceSouthPanel.CONTENT_INDEX || col == ITReplaceSouthPanel.CHECKBOX_INDEX;
return col == ITReplaceSouthPanel.CHECKBOX_INDEX;
}
/**

14
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITTableEditorPane.java

@ -1,17 +1,21 @@
package com.fr.design.actions.replace.ui;
import com.fr.base.TRL;
import com.fr.design.actions.replace.info.base.ITContent;
import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.share.ui.base.MouseClickListener;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
@ -75,6 +79,16 @@ public class ITTableEditorPane<T> extends BasicPane {
//改变面板的各个状态
changeComponentStatus(content, row, col);
}
if (col == ITReplaceSouthPanel.CONTENT_INDEX) {
ITContent content = (ITContent) editTable.getValueAt(row, ITReplaceSouthPanel.CONTENT_INDEX);
if (StringUtils.isNotEmpty(GeneralUtils.objectToString(content.getTrlString()))) {
ITReplaceMainDialog.setITReplaceFlag(true);
TRL trl = new TRL(GeneralUtils.objectToString(content.getTrlString()));
DesignerContext.getDesignerFrame().openOrActiveTemplate(content.getTemplatePath());
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().navigate(trl);
}
ITReplaceMainDialog.setITReplaceFlag(false);
}
}
});

3
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -21,6 +21,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.report.RichTextEditingPane;
import com.fr.design.style.color.UIToolbarColorButton;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.DesignUtils;
import com.fr.general.FRFont;
import com.fr.log.FineLoggerFactory;
import com.fr.report.cell.cellattr.core.RichTextConverter;
@ -104,7 +105,7 @@ public class RichTextToolBar extends BasicPane {
}
private void initAllButton() {
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox = new UIComboBox(DesignUtils.getAvailableFontFamilyNames4Report());
fontNameComboBox.setPreferredSize(new Dimension(144, 20));
fontSizeComboBox = new UIComboBox(FRFontPane.getFontSizes());
colorSelectPane = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png"));

7
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -6,8 +6,6 @@ import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.base.TRL;
import com.fr.base.extension.FileExtension;
import com.fr.base.theme.FineColorGather;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FineColorSynchronizer;
import com.fr.base.theme.ReportTheme;
import com.fr.base.theme.TemplateTheme;
@ -41,7 +39,7 @@ import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.fun.PreviewProvider;
import com.fr.design.fun.PropertyItemPaneProvider;
import com.fr.design.fun.ReportSupportedFileUIProvider;
@ -80,7 +78,6 @@ import com.fr.file.FILEChooserPane;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.form.main.Form;
import com.fr.general.ComparatorUtils;
import com.fr.general.ModuleContext;
import com.fr.grid.Grid;
@ -1178,7 +1175,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
public boolean saveShareFile() {
FILE newFile = createNewEmptyFile();
//如果文件已经打开, 那么就覆盖关闭掉他
MutilTempalteTabPane.getInstance().closeFileTemplate(newFile);
MultiTemplateTabPane.getInstance().closeFileTemplate(newFile);
final WorkBook tpl = this.getTarget();
// 弹出输入参数
java.util.Map<String, Object> parameterMap = inputParameters(tpl);

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

@ -51,7 +51,7 @@ import com.fr.stable.AssistUtils;
import com.fr.stable.ColumnRow;
import com.fr.stable.Constants;
import com.fr.stable.GraphDrawHelper;
import com.fr.stable.script.CalculatorUtils;
import com.fr.script.CalculatorUtils;
import com.fr.stable.unit.FU;
import com.fr.stable.unit.UNIT;
import com.fr.third.antlr.ANTLRException;

9
designer-realize/src/main/java/com/fr/quickeditor/CellQuickEditor.java

@ -58,6 +58,9 @@ import java.util.Set;
public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
protected static final Dimension LABEL_DIMENSION = new Dimension(GraphHelper.getWidth(Toolkit.i18nText("Fine-Design_Report_Insert_Cell_Element")), 20);
// 使用UILabel.getPreferredSize时,若文本为html高度被默认增加3
protected static final Dimension HIDDEN_LABEL_DIMENSION = new Dimension(0, -3);
protected static final int VGAP = 10, HGAP = 8, VGAP_INNER = 3;
/**
@ -285,10 +288,10 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
if (selectedOneCell) {
columnRowTextField.setPreferredSize(null);
cellLabel.setPreferredSize(null);
multipleLabelTip.setPreferredSize(new Dimension());
multipleLabelTip.setPreferredSize(HIDDEN_LABEL_DIMENSION);
} else {
columnRowTextField.setPreferredSize(new Dimension());
cellLabel.setPreferredSize(new Dimension());
columnRowTextField.setPreferredSize(HIDDEN_LABEL_DIMENSION);
cellLabel.setPreferredSize(HIDDEN_LABEL_DIMENSION);
multipleLabelTip.setPreferredSize(null);
}
}

37
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -16,7 +16,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.deeplink.DeepLinkManager;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.MultiTemplateTabPane;
import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor;
import com.fr.design.gui.ibutton.UIButton;
@ -72,17 +72,15 @@ import com.fr.start.common.SplashCommon;
import com.fr.start.module.StartupArgs;
import com.fr.start.preload.PreLoadService;
import com.fr.start.server.ServerTray;
import com.fr.third.org.apache.commons.lang3.time.StopWatch;
import com.fr.van.chart.map.server.ChartMapEditorAction;
import com.fr.workspace.WorkContext;
import javax.swing.JPanel;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.MatteBorder;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -119,11 +117,11 @@ public class MainDesigner extends BaseDesigner {
* @param args 参数
*/
public static void main(String[] args) {
StopWatch watch = new StopWatch();
watch.start();
DesignerStartupContext.getRecorder().start();
showSplash();
DesignerEnvManager.getEnvManager();
startPreload0();
DesignerLifecycleMonitorContext.getMonitor().beforeStart();
@ -143,7 +141,7 @@ public class MainDesigner extends BaseDesigner {
});
Module designerRoot = ModuleContext.parseRoot("designer-startup.xml");
FineLoggerFactory.getLogger().debug("designer-startup prepared cost {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS));
FineLoggerFactory.getLogger().debug("Designer prepared.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS));
//传递启动参数
designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args));
try {
@ -156,8 +154,7 @@ public class MainDesigner extends BaseDesigner {
//初始化一下serverTray
ServerTray.init();
}
FineLoggerFactory.getLogger().info("Designer started.Time used {} ms", watch.getTime());
watch.stop();
FineLoggerFactory.getLogger().info("Designer started.Time used {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS));
SwitchForSwingChecker.initThreadMonitoring();
}
@ -168,7 +165,9 @@ public class MainDesigner extends BaseDesigner {
private static void startPreload1() {
CompletableFuture<Void> initLookAndFeel = CompletableFuture.runAsync(DesignUtils::initLookAndFeel);
PreLoadService.getInstance().addFuture(initLookAndFeel);
PreLoadService.getInstance().addUIFuture(initLookAndFeel);
showSplash();
}
/**
@ -189,16 +188,12 @@ public class MainDesigner extends BaseDesigner {
action.run();
}
});
Runnable fontLoad = () -> {
Font[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
};
PreLoadService.getInstance().addRunnable(fontLoad);
}
private static void showSplash() {
// 快快显示启动画面
// vito: 这里必须用 wait, 不然会导致莫名其妙的问题
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
@Override
public void run() {
@ -392,7 +387,7 @@ public class MainDesigner extends BaseDesigner {
for (int i = 0; i < items.length; i++) {
menu.add(items[i]);
}
GUICoreUtils.showPopupMenu(menu, MutilTempalteTabPane.getInstance(), MutilTempalteTabPane.getInstance().getX() - PREVIEW_DOWN_X_GAP, MutilTempalteTabPane.getInstance().getY() - 1 + MutilTempalteTabPane.getInstance().getHeight());
GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.getInstance(), MultiTemplateTabPane.getInstance().getX() - PREVIEW_DOWN_X_GAP, MultiTemplateTabPane.getInstance().getY() - 1 + MultiTemplateTabPane.getInstance().getHeight());
}
@Override
@ -414,8 +409,8 @@ public class MainDesigner extends BaseDesigner {
return;
}
saveButton.setEnabled(!jt.isSaved() && !DesignModeContext.isVcsMode() && jt.checkEnable());
MutilTempalteTabPane.getInstance().refreshOpenedTemplate(HistoryTemplateListCache.getInstance().getHistoryList());
MutilTempalteTabPane.getInstance().repaint();
MultiTemplateTabPane.getInstance().refreshOpenedTemplate(HistoryTemplateListCache.getInstance().getHistoryList());
MultiTemplateTabPane.getInstance().repaint();
if (DesignerEnvManager.getEnvManager().isSupportUndo()) {
undo.setEnabled(jt.canUndo());
redo.setEnabled(jt.canRedo());

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

@ -146,13 +146,14 @@ import com.fr.start.common.DesignerStartupPool;
import com.fr.task.Once;
import com.fr.workspace.WorkContext;
import com.fr.xml.ReportXMLUtils;
import javax.swing.SwingWorker;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import javax.swing.SwingWorker;
/**
* Created by juhaoyu on 2018/1/31.
@ -192,6 +193,8 @@ public class DesignerActivator extends Activator implements Prepare {
CompletableFuture<Void> mainDesignerPrepare = CompletableFuture.runAsync(this::designerModuleStart, DesignerStartupPool.common());
CompletableFuture<Void> extendDesignerPrepare = CompletableFuture.runAsync(this::designerExtendStart, DesignerStartupPool.common());
CompletableFuture<Void> otherFeaturesPrepare = CompletableFuture.runAsync(() -> {
startBBSLoginAuthServer();
migrateBBSInfoFromFineDB();
@ -207,7 +210,7 @@ public class DesignerActivator extends Activator implements Prepare {
storePassport();
AlphaFineHelper.switchConfig4Locale();
RecoverManager.register(new RecoverForDesigner());
});
}, DesignerStartupPool.common());
CompletableFuture<Void> resourcePrepare = CompletableFuture.runAsync(() -> {
pushUpdateTask.run();
@ -218,7 +221,7 @@ public class DesignerActivator extends Activator implements Prepare {
}, DesignerStartupPool.common());
CompletableFuture
.allOf(mainDesignerPrepare, themeConfigPrepare, otherFeaturesPrepare, resourcePrepare)
.allOf(mainDesignerPrepare, extendDesignerPrepare, themeConfigPrepare, otherFeaturesPrepare, resourcePrepare)
.join();
}
@ -272,8 +275,12 @@ public class DesignerActivator extends Activator implements Prepare {
designerRegister();
InformationCollector.getInstance().collectStartTime();
}
private void designerExtendStart() {
SharableManager.start();
InformationCollector.getInstance().collectStartTime();
GuideRegister.register();
}
@ -413,16 +420,16 @@ public class DesignerActivator extends Activator implements Prepare {
*/
private static void registerCellEditor() {
ActionFactory.registerCellEditor(String.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(Number.class, new CellStringQuickEditor());
ActionFactory.registerCellEditor(BaseFormula.class, new CellFormulaQuickEditor());
ActionFactory.registerCellEditor(SubReport.class, new CellSubReportEditor());
ActionFactory.registerCellEditor(RichText.class, new CellRichTextEditor());
ActionFactory.registerCellEditor(DSColumn.class, new CellDSColumnEditor());
ActionFactory.registerCellEditor(Image.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(BiasTextPainter.class, new CellBiasTextPainterEditor());
ActionFactory.registerCellEditor(BufferedImage.class, new CellImageQuickEditor());
ActionFactory.registerCellEditor(CellImagePainter.class, new CellImageQuickEditor());
ActionFactory.registerAsyncInitCellEditorClass(String.class, CellStringQuickEditor.class);
ActionFactory.registerAsyncInitCellEditorClass(Number.class, CellStringQuickEditor.class);
ActionFactory.registerAsyncInitCellEditorClass(BaseFormula.class, CellFormulaQuickEditor.class);
ActionFactory.registerAsyncInitCellEditorClass(SubReport.class, CellSubReportEditor.class);
ActionFactory.registerAsyncInitCellEditorClass(RichText.class, CellRichTextEditor.class);
ActionFactory.registerAsyncInitCellEditorClass(DSColumn.class, CellDSColumnEditor.class);
ActionFactory.registerAsyncInitCellEditorClass(Image.class, CellImageQuickEditor.class);
ActionFactory.registerAsyncInitCellEditorClass(BiasTextPainter.class, CellBiasTextPainterEditor.class);
ActionFactory.registerAsyncInitCellEditorClass(BufferedImage.class, CellImageQuickEditor.class);
ActionFactory.registerAsyncInitCellEditorClass(CellImagePainter.class, CellImageQuickEditor.class);
Set<ElementUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(ElementUIProvider.MARK_STRING);
for (ElementUIProvider provider : providers) {
@ -430,7 +437,7 @@ public class DesignerActivator extends Activator implements Prepare {
if (provider.quickEditor() == null) {
continue;
}
ActionFactory.registerCellEditor(provider.targetObjectClass(), provider.quickEditor().newInstance());
ActionFactory.registerAsyncInitCellEditorClass(provider.targetObjectClass(), provider.quickEditor());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}

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

@ -67,7 +67,7 @@ public class DesignerStartup extends Activator {
registerDaoSelector();
Stopwatch beforeWatch = Stopwatch.createStarted();
PreLoadService.getInstance().waitForAll();
PreLoadService.getInstance().waitForCommon();
FineLoggerFactory.getLogger().debug( "DesignerStartup cost {} ms to wait load", beforeWatch.elapsed(TimeUnit.MILLISECONDS));
if (DesignUtils.isStarted()) {

56
designer-realize/src/main/java/com/fr/start/module/optimized/DesignerStartupPageActivator.java

@ -5,9 +5,11 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.ui.util.UIUtil;
import com.fr.log.FineLoggerFactory;
import com.fr.module.Activator;
import com.fr.module.engine.base.ActivatorContext;
import com.fr.start.SplashContext;
import com.fr.start.common.DesignerStartupContext;
import com.fr.start.module.StartupArgs;
import com.fr.start.preload.PreLoadService;
import com.fr.start.util.DesignerStartupPageUtil;
import com.fr.startup.metric.DesignerMetrics;
import com.fr.startup.metric.DesignerStartupModel;
@ -18,6 +20,7 @@ import com.fr.third.org.apache.commons.lang3.time.StopWatch;
import com.fr.value.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
/**
@ -37,6 +40,13 @@ public class DesignerStartupPageActivator extends Activator {
}
};
/**
* 上下文
*/
private final ActivatorContext activatorContext = new ActivatorContext();
private final CountDownLatch LATCH = new CountDownLatch(1);
@Override
public void start() {
@ -65,13 +75,24 @@ public class DesignerStartupPageActivator extends Activator {
// 即时暂停
suspendRecorder(context);
addMutable(ActivatorContext.KEY, activatorContext);
PreLoadService.getInstance().waitForUI();
UIUtil.invokeLaterIfNeeded(() -> {
StartupPageModel model = StartupPageModel.create();
context.setStartupPageModel(model);
StopWatch suspendWatch = new StopWatch();
final Runnable recordSuspend = () -> {
long suspendTime = suspendWatch.getTime(TimeUnit.MILLISECONDS);
activatorContext.setSuspendTime(suspendTime);
};
// selectAndOpenLast
model.setOpenLastTemplateRunnable(() -> {
recordSuspend.run();
context.setOpenLastFile(true);
handleModel(model);
launchAfterWarmup();
@ -79,6 +100,7 @@ public class DesignerStartupPageActivator extends Activator {
// selectAndOpenEmpty
model.setOpenEmptyTemplateRunnable(() -> {
recordSuspend.run();
context.setOpenEmpty(true);
handleModel(model);
launchAfterWarmup();
@ -86,6 +108,7 @@ public class DesignerStartupPageActivator extends Activator {
// selectAndCreateNew
model.setCreateNewTemplateRunnable(() -> {
recordSuspend.run();
context.setCreateNew(true);
handleModel(model);
launchAfterWarmup();
@ -94,8 +117,11 @@ public class DesignerStartupPageActivator extends Activator {
StartupPageWindow window = new StartupPageWindow(model);
window.setVisible(true);
context.setOnWaiting(true);
suspendWatch.start();
});
waitSubTask();
}
private void suspendRecorder(DesignerStartupContext context) {
@ -123,7 +149,11 @@ public class DesignerStartupPageActivator extends Activator {
StopWatch stopWatch = StopWatch.createStarted();
try {
DesignerStartupContext.getRecorder().resume();
StopWatch recorder = DesignerStartupContext.getRecorder();
if (recorder.isSuspended()) {
recorder.resume();
}
// 等待中切换
DesignerStartupContext.getInstance().setOnWaiting(false);
@ -136,9 +166,9 @@ public class DesignerStartupPageActivator extends Activator {
DesignerStartupContext.getInstance().setOnStartup(false);
recordStartupEnd(stopWatch);
});
markComplete();
}
FineLoggerFactory.getLogger().debug("designer-startup-page started cost {} ms", DesignerStartupContext.getRecorder().getTime(TimeUnit.MILLISECONDS));
}
private void recordStartupEnd(StopWatch stopWatch) {
@ -150,6 +180,28 @@ public class DesignerStartupPageActivator extends Activator {
model.fill();
}
/**
* 阻塞住当前的方法
* 只有 UI 交互开始执行的时候才会停止阻塞
*/
private void waitSubTask() {
try {
LATCH.await();
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
private void markComplete() {
try {
LATCH.countDown();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
@Override
public void stop() {

36
designer-realize/src/main/java/com/fr/start/preload/PreLoadService.java

@ -11,7 +11,9 @@ import java.util.concurrent.CompletableFuture;
**/
public class PreLoadService {
private List<CompletableFuture<?>> futures = new ArrayList<>();
private List<CompletableFuture<?>> commonFutures = new ArrayList<>();
private List<CompletableFuture<?>> uIFutures = new ArrayList<>();
public static PreLoadService getInstance() {
return PreLoadServiceHolder.INSTANCE;
@ -21,16 +23,40 @@ public class PreLoadService {
private static final PreLoadService INSTANCE = new PreLoadService();
}
/**
* 添加 UI 的异步任务
*
* @param future 任务
*/
public void addUIFuture(CompletableFuture<?> future) {
uIFutures.add(future);
}
public void addFuture(CompletableFuture<?> future) {
futures.add(future);
commonFutures.add(future);
}
/**
* 添加通用的异步任务
*
* @param runnable 任务
*/
public void addRunnable(Runnable runnable) {
futures.add(CompletableFuture.runAsync(runnable, DesignerStartupPool.common()));
commonFutures.add(CompletableFuture.runAsync(runnable, DesignerStartupPool.common()));
}
/**
* 等待通用的异步任务执行
*/
public void waitForCommon() {
CompletableFuture.allOf(commonFutures.toArray(new CompletableFuture[0])).join();
}
public void waitForAll() {
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
/**
* 等待UI异步任务执行
*/
public void waitForUI() {
CompletableFuture.allOf(uIFutures.toArray(new CompletableFuture[0])).join();
}
}

Loading…
Cancel
Save