Browse Source

Merging in latest from upstream (DESIGN/design:refs/heads/release/11.0)

* commit 'a9348258f5dd746f1919be7d4ed5587475115fb1': (185 commits)
  REPORT-95367 fix:关闭icon模糊
  修改代码行数
  往前遍历要到0
  REPORT-95401 && REPORT-95218【FVS支持多开】打开多个fvs之后打开frm,再次打开fvs,tab栏自适应异常【FVS支持多开】禁用插件,强制保存fvs模板,可以取消勾选
  REPORT-95362 fix:tab上的toolTip被截断
  添加注释
  代码修改
  REPORT-95197 && REPORT-95194 打开远程工作目录面板,选择远程目录点确定,没有强制要求保存fvs模板
  REPORT-95068【FVS支持多开】兼容问题》release-jar+旧插件,连续打开两张fvs模板,关闭后异常
  REPORT-94999  frm-tab栏与fvs-tab栏切换时,会出现跳到其他模式
  REPORT-94114 11.0.15.1维护版本,同步到persist
  改一下方法名称
  REPORT-94510 决策报表-tab块组件大小设置0-样式设置"菜单式"-预览模板空白
  REPORT-91253 FR源码中存在密钥硬编码
  REPORT-94504 关闭所有模板,当前模板是否有未保存内容没有校验,模板内容有丢失风险
  添加注释
  REPORT-94400【FVS支持多开】来回切换fvs模板,tab栏会晃动
  REPORT-94379 控件显示增强插件安装启用后,部分控件的样式设置有问题
  REPORT-94379 控件显示增强插件安装启用后,部分控件的样式设置有问题
  REPORT-94597 安装【平台内打开标签页】插件,FR图表超链会多两个重复下拉项 改用ListMap保持一致
  ...
release/11.0
Bruce.Deng-邓铖臻 2 years ago
parent
commit
5025b854b3
  1. 12
      designer-base/src/main/java/com/fr/base/svg/SVGIcon.java
  2. 117
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  3. 16
      designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java
  4. 16
      designer-base/src/main/java/com/fr/design/actions/community/BugAction.java
  5. 15
      designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java
  6. 18
      designer-base/src/main/java/com/fr/design/actions/community/CusDemandAction.java
  7. 16
      designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java
  8. 16
      designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java
  9. 16
      designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java
  10. 17
      designer-base/src/main/java/com/fr/design/actions/community/SignAction.java
  11. 15
      designer-base/src/main/java/com/fr/design/actions/community/StudyPlanAction.java
  12. 15
      designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java
  13. 19
      designer-base/src/main/java/com/fr/design/actions/community/TemplateStoreAction.java
  14. 14
      designer-base/src/main/java/com/fr/design/actions/community/UpAction.java
  15. 15
      designer-base/src/main/java/com/fr/design/actions/community/WorkOrderCenterAction.java
  16. 2
      designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java
  17. 2
      designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java
  18. 2
      designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java
  19. 2
      designer-base/src/main/java/com/fr/design/actions/file/DelFileAction.java
  20. 2
      designer-base/src/main/java/com/fr/design/actions/file/LocateAction.java
  21. 3
      designer-base/src/main/java/com/fr/design/actions/file/PreferenceAction.java
  22. 2
      designer-base/src/main/java/com/fr/design/actions/file/RenameAction.java
  23. 2
      designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java
  24. 14
      designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java
  25. 67
      designer-base/src/main/java/com/fr/design/constants/UIConstants.java
  26. 53
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  27. 3
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  28. 16
      designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java
  29. 28
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java
  30. 12
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java
  31. 13
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java
  32. 14
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  33. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java
  34. 4
      designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TreeSearchToolbarPane.java
  35. 7
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/DesensitizationOpenPane.java
  36. 15
      designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java
  37. 14
      designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java
  38. 8
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapperHelper.java
  39. 22
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/ServerTableDataWrapper.java
  40. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java
  41. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java
  42. 20
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java
  43. 7
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TemplateTableDataWrapper.java
  44. 15
      designer-base/src/main/java/com/fr/design/extra/exe/callback/handle/PluginCallBackHelper.java
  45. 2
      designer-base/src/main/java/com/fr/design/extra/exe/callback/handle/PluginTaskResultErrorDialog.java
  46. 7
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  47. 349
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java
  48. 328
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  49. 10
      designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java
  50. 60
      designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java
  51. 3
      designer-base/src/main/java/com/fr/design/gui/UILookAndFeel.java
  52. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/AbstractNameableCreator.java
  53. 50
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  54. 31
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java
  55. 18
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java
  56. 2
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  57. 29
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java
  58. 14
      designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java
  59. 5
      designer-base/src/main/java/com/fr/design/gui/itree/UITreeUI.java
  60. 15
      designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java
  61. 16
      designer-base/src/main/java/com/fr/design/gui/style/TranslucentBorderSpecialPane.java
  62. 47
      designer-base/src/main/java/com/fr/design/i18n/LocaleLinkProvider.java
  63. 8
      designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java
  64. 41
      designer-base/src/main/java/com/fr/design/icon/WarningIcon.java
  65. 110
      designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java
  66. 13
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java
  67. 32
      designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java
  68. 34
      designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java
  69. 34
      designer-base/src/main/java/com/fr/design/locale/impl/BbsSpaceMark.java
  70. 30
      designer-base/src/main/java/com/fr/design/locale/impl/DataMaskMark.java
  71. 28
      designer-base/src/main/java/com/fr/design/locale/impl/LineEngineMark.java
  72. 2
      designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java
  73. 2
      designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java
  74. 20
      designer-base/src/main/java/com/fr/design/login/DesignerLoginBridge.java
  75. 36
      designer-base/src/main/java/com/fr/design/mainframe/CenterRegionContainerPane.java
  76. 8
      designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java
  77. 8
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java
  78. 12
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  79. 5
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  80. 182
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  81. 8
      designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java
  82. 10
      designer-base/src/main/java/com/fr/design/mainframe/ToolKitConfigStrategy.java
  83. 3
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java
  84. 16
      designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java
  85. 4
      designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateTreeSearchToolbarPane.java
  86. 6
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  87. 33
      designer-base/src/main/java/com/fr/design/menu/MenuDef.java
  88. 7
      designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java
  89. 4
      designer-base/src/main/java/com/fr/design/preview/FormPreview.java
  90. 4
      designer-base/src/main/java/com/fr/design/preview/MobilePreview.java
  91. 4
      designer-base/src/main/java/com/fr/design/preview/PagePreview.java
  92. 4
      designer-base/src/main/java/com/fr/design/preview/ViewPreview.java
  93. 4
      designer-base/src/main/java/com/fr/design/preview/WritePreview.java
  94. 2
      designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java
  95. 20
      designer-base/src/main/java/com/fr/design/update/actions/NewFeatureAction.java
  96. 16
      designer-base/src/main/java/com/fr/design/utils/SvgDraw.java
  97. 73
      designer-base/src/main/java/com/fr/design/utils/SvgDrawUtils.java
  98. 28
      designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java
  99. 186
      designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java
  100. 16
      designer-base/src/main/java/com/fr/design/widget/btn/ButtonConstants.java
  101. Some files were not shown because too many files have changed in this diff Show More

12
designer-base/src/main/java/com/fr/base/svg/SVGIcon.java

@ -1,9 +1,12 @@
package com.fr.base.svg;
import com.fr.design.utils.SvgDrawUtils;
import com.fr.general.IOUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.Icon;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -34,10 +37,7 @@ public class SVGIcon implements Icon {
public void paintIcon(Component c, Graphics g, int x, int y) {
if (HI_DPI_SURPORT) {
Graphics2D graphics = (Graphics2D) g.create(x, y, image.getWidth(null), image.getHeight(null));
float scale = SYSTEM_SCALE;
graphics.scale(1 / scale, 1 / scale);
graphics.drawImage(image, 0, 0, null);
graphics.scale(1.0D, 1.0D);
SvgDrawUtils.doDrawSVG(graphics, () -> SvgDrawUtils.drawImage(graphics, image, 0, 0, null));
graphics.dispose();
} else {
g.drawImage(image, x, y, null);

117
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -65,6 +65,9 @@ import java.util.HashSet;
import static javax.swing.JOptionPane.QUESTION_MESSAGE;
public class EnvChangeEntrance {
private static final String BRANCH_TAG = "#";
private static final String BRANCH_BEGIN = "-";
private static final int BRANCH_SUB_LENGTH = 13;
public static EnvChangeEntrance getInstance() {
return HOLDER.singleton;
@ -116,19 +119,14 @@ public class EnvChangeEntrance {
if (!checkValid) {
return false;
}
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
DesignerEnvManager.getEnvManager().setCurEnvName(envName);
DesignUtils.refreshDesignerFrame();
DesignTableDataManager.fireDSChanged(new HashMap<String, String>());
if (WorkContext.getCurrent().isLocal()) {
//初始化一下serverTray
ServerTray.init();
}
}
});
//如果是相同环境
if (isSameEnv(workspace)) {
//目前切换到相同环境需要更新一下名字,后续如果有别的操作直接往里面加就行了
switch2SameEnv(envName);
} else {
//切换到新环境,做下封装
switch2OtherEnv(workspace, envName);
}
// REPORT-25688如果是war包部署的服务器,给与提示
if (WorkContext.getCurrent().isWarDeploy()) {
FineJOptionPane.showMessageDialog(null, Toolkit.i18nText("Fine-Design_Basic_War_Deploy_Tip"),
@ -136,7 +134,7 @@ public class EnvChangeEntrance {
}
//REPORT-13810如果只是添加了工作目录,没有切换,这里ToolArea也是要显示新建的工作目录
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (template != null) {
if (JTemplate.isValid(template)) {
template.refreshToolArea();
}
PluginErrorDesignReminder.getInstance().remindStartFailedPlugins();
@ -156,6 +154,47 @@ public class EnvChangeEntrance {
return true;
}
/**
* 切换到其他环境
*
* @param workspace 要切换的环境
* @param envName 要切换的环境名称
*/
private void switch2OtherEnv(Workspace workspace, String envName) {
WorkContext.switchTo(workspace, new WorkContextCallback() {
@Override
public void done() {
DesignerEnvManager.getEnvManager().setCurEnvName(envName);
DesignUtils.refreshDesignerFrame();
DesignTableDataManager.fireDSChanged(new HashMap<String, String>());
if (WorkContext.getCurrent().isLocal()) {
//初始化一下serverTray
ServerTray.init();
}
}
});
}
/**
* 切换到相同环境要做的事情
*
* @param envName 当前的环境名
*/
private void switch2SameEnv(String envName) {
//当前环境名称可能重命名更改过,需要更新一下,防止启动失败
DesignerEnvManager.getEnvManager().setCurEnvName(envName);
}
/**
* 是否切换到相同环境
*
* @param workspace 要切换的环境
* @return 是则返回true
*/
private boolean isSameEnv(Workspace workspace) {
return AssistUtils.equals(WorkContext.getCurrent(), workspace);
}
/**
* 这个功能留着可能会加回来先做注释处理
* 切换远程环境之前进行版本检测当版本不一致的时候提示
@ -201,13 +240,14 @@ public class EnvChangeEntrance {
return true;
}
/**
/**
* 对选择的环境做服务检测
*
* @param selectedEnv 选择的工作环境
*/
public void showServiceDialog(DesignerWorkspaceInfo selectedEnv) throws Exception {
//是否需要做服务校验
if(needCheckBranch(selectedEnv)) {
if (needCheckBranch(selectedEnv)) {
String localBranch;
String remoteBranch;
WorkspaceConnectionInfo connectionInfo = selectedEnv.getConnection();
@ -228,18 +268,18 @@ public class EnvChangeEntrance {
StringBuilder textBuilder = new StringBuilder();
for (Class clazz : noExistServiceSet) {
WorkspaceAPI workspaceAPI = (WorkspaceAPI) clazz.getAnnotation(WorkspaceAPI.class);
if(workspaceAPI == null){
if (workspaceAPI == null) {
FineLoggerFactory.getLogger().info("workspace service {} get annotation failed", clazz);
continue;
}
if(workspaceAPI.ignore()){
if (workspaceAPI.ignore()) {
continue;
}
String descriptionOfCN = InterProviderFactory.getProvider().getLocText(workspaceAPI.description());
textBuilder.append(descriptionOfCN).append("\n");
}
String areaText = textBuilder.toString();
if(StringUtils.isEmpty(areaText)){
if (StringUtils.isEmpty(areaText)) {
return;
}
@ -251,24 +291,25 @@ public class EnvChangeEntrance {
* 判断是否需要做版本验证判断依据为
* 1选择的环境为远程环境
* 2一个月内不弹出是否勾选
*
* @param selectedEnv 选择的环境
* @return
*/
private boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv){
if(selectedEnv.getType() == DesignerWorkspaceType.Remote){
private boolean needCheckBranch(DesignerWorkspaceInfo selectedEnv) {
if (selectedEnv.getType() == DesignerWorkspaceType.Remote) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
if(StringUtils.isEmpty(selectedEnv.getRemindTime())){
if (StringUtils.isEmpty(selectedEnv.getRemindTime())) {
return true;
}
//获取记录的时间
Date remindTime = format.parse(selectedEnv.getRemindTime());
calendar.setTime(remindTime);
//获取一个月后的时间
calendar.add(Calendar.MONTH,1);
calendar.add(Calendar.MONTH, 1);
//与当前时间作对比,然后判断是否提示
if(new Date().after(calendar.getTime())){
if (new Date().after(calendar.getTime())) {
return true;
}
} catch (ParseException e) {
@ -280,21 +321,22 @@ public class EnvChangeEntrance {
/**
* 获取不存在的服务列表
*
* @param info 环境连接信息
* @return 以Set形式返回不存在的服务
*/
public Set<Class> getNoExistServiceSet(WorkspaceConnectionInfo info){
public Set<Class> getNoExistServiceSet(WorkspaceConnectionInfo info) {
Set<Class> noExistServiceSet = new HashSet<Class>();
Set<Class> remoteServiceSet = new HashSet<Class>();
Set<Class> localServiceSet = FineObjectPool.getInstance().getServerPool().keySet();
try {
JSONArray serviceArray = new FunctionalHttpRequest(info).getServiceList();
for(int i = 0; i < serviceArray.size(); i++){
try{
for (int i = 0; i < serviceArray.size(); i++) {
try {
Class clazz = Class.forName((String) serviceArray.get(i));
remoteServiceSet.add(clazz);
} catch (Exception e){
} catch (Exception e) {
continue;
}
}
@ -304,12 +346,12 @@ public class EnvChangeEntrance {
} catch (WorkspaceConnectionException e) {
FineLoggerFactory.getLogger().info(e.getMessage());
//根据本地的服务列表做逐一检测
for(Class clazz : localServiceSet) {
for (Class clazz : localServiceSet) {
Method testMethod = Reflect.on(Method.class).create(clazz, "connectTest", new Class[0], String.class, new Class[0], 1025, 8, null, null, null, null).get();
WorkspaceProxyPool proxyPool = (WorkspaceProxyPool) (((RemoteWorkspace) WorkContext.getCurrent()).getClient()).getPool();
Result result = proxyPool.testInvoker(testMethod);
Exception invokeException = (Exception) result.getException();
if(invokeException != null){
if (invokeException != null) {
Exception cause = (Exception) invokeException.getCause();
//获取被包装最底层的异常
while (cause != null) {
@ -317,26 +359,27 @@ public class EnvChangeEntrance {
cause = (Exception) invokeException.getCause();
}
//该异常表示服务不存在
if(invokeException instanceof ClassNotFoundException){
if (invokeException instanceof ClassNotFoundException) {
noExistServiceSet.add(clazz);
}
}
}
return noExistServiceSet;
} catch (Exception e){
FineLoggerFactory.getLogger().error(e.getMessage(),e);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return noExistServiceSet;
}
}
/**
* 格式化分支版本号
*
* @param branch 初始的分支版本号
* @return 格式化后的版本号
*/
private String formatBranch(String branch){
if(branch.contains("#")){
return branch.substring(branch.lastIndexOf("-") + 1, branch.length() - 13);
private String formatBranch(String branch) {
if (branch.contains(BRANCH_TAG)) {
return branch.substring(branch.lastIndexOf(BRANCH_BEGIN) + 1, branch.length() - BRANCH_SUB_LENGTH);
}
return branch;
}
@ -370,7 +413,7 @@ public class EnvChangeEntrance {
@Override
public void doOk() {
SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(true, SwingUtilities.getWindowAncestor(envListPane));
if (!saveSomeTemplatePane.showSavePane()) {
if (!saveSomeTemplatePane.showSavePane(true)) {
// 用户取消保存时,取消切换目录操作
return;
}

16
designer-base/src/main/java/com/fr/design/actions/community/BBSAction.java

@ -1,14 +1,22 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import javax.swing.*;
import javax.swing.KeyStroke;
public class BBSAction extends AbstractDesignerSSO {
/**
* 云中心帆软社区页在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Bbs";
/**
* 云中心帆软社区页默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Bbs_Default";
public BBSAction() {
this.setMenuKeySet(BBS);
@ -20,7 +28,7 @@ public class BBSAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs", "http://bbs.fanruan.com/");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
public static final MenuKeySet BBS = new MenuKeySet() {

16
designer-base/src/main/java/com/fr/design/actions/community/BugAction.java

@ -1,13 +1,23 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import javax.swing.*;
import javax.swing.KeyStroke;
public class BugAction extends AbstractDesignerSSO {
/**
* 云中心产品反馈页在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Bugs";
/**
* 云中心产品反馈页默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Bugs_Default";
public BugAction() {
this.setMenuKeySet(BUG);
this.setName(getMenuKeySet().getMenuName());
@ -17,7 +27,7 @@ public class BugAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.bugs", "https://service.fanruan.com/PF/FR/feedback?type=2");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
public static final MenuKeySet BUG = new MenuKeySet() {

15
designer-base/src/main/java/com/fr/design/actions/community/CenterAction.java

@ -1,7 +1,7 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import javax.swing.KeyStroke;
@ -9,6 +9,17 @@ import javax.swing.KeyStroke;
* Created by XINZAI on 2018/8/23.
*/
public class CenterAction extends UpAction {
/**
* 云中心活动中心页在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Act_Center";
/**
* 云中心活动中心页默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Act_Center_Default";
public CenterAction() {
this.setMenuKeySet(CENTER);
this.setName(getMenuKeySet().getMenuName());
@ -18,7 +29,7 @@ public class CenterAction extends UpAction {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.center", "http://bbs.fanruan.com/events/");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
public static final MenuKeySet CENTER = new MenuKeySet() {

18
designer-base/src/main/java/com/fr/design/actions/community/CusDemandAction.java

@ -1,18 +1,28 @@
package com.fr.design.actions.community;
import com.fr.base.BaseUtils;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import javax.swing.KeyStroke;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
* Created by XINZAI on 2018/8/23.
*/
public class CusDemandAction extends UpAction{
/**
* 云中心发布需求页在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Demand";
/**
* 云中心发布需求页默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Demand_Default";
public CusDemandAction()
{
this.setMenuKeySet(DEMAND);
@ -25,7 +35,7 @@ public class CusDemandAction extends UpAction{
@Override
public void actionPerformed(ActionEvent arg0)
{
String url = CloudCenter.getInstance().acquireUrlByKind("bbs.demand", "https://market.fanruan.com/demand");
String url = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
BrowseUtils.browser(url);
}

16
designer-base/src/main/java/com/fr/design/actions/community/FacebookFansAction.java

@ -1,14 +1,24 @@
package com.fr.design.actions.community;
import com.fr.base.svg.IconUtils;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
public class FacebookFansAction extends UpAction {
/**
* 云中心facebook页在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_FaceBook";
/**
* 云中心facebook页默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_FaceBook_Default";
public FacebookFansAction() {
this.setMenuKeySet(FACEBOOKFANS);
this.setName(getMenuKeySet().getMenuName());
@ -18,7 +28,7 @@ public class FacebookFansAction extends UpAction {
@Override
public void actionPerformed(ActionEvent arg0) {
BrowseUtils.browser(CloudCenter.getInstance().acquireUrlByKind("facebook.fans.tw", "https://www.facebook.com/twfinereport"));
BrowseUtils.browser(LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT));
}
public static final MenuKeySet FACEBOOKFANS = new MenuKeySet() {

16
designer-base/src/main/java/com/fr/design/actions/community/NeedAction.java

@ -1,13 +1,23 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import javax.swing.*;
import javax.swing.KeyStroke;
public class NeedAction extends AbstractDesignerSSO {
/**
* 云中心产品反馈页在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Need";
/**
* 云中心产品反馈页默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Need_Default";
public NeedAction() {
this.setMenuKeySet(NEED);
this.setName(getMenuKeySet().getMenuName());
@ -18,7 +28,7 @@ public class NeedAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.needs", "https://service.fanruan.com/PF/FR/feedback?type=1");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY ,PROPS_LINK_KEY_DEFAULT);
}
public static final MenuKeySet NEED = new MenuKeySet() {

16
designer-base/src/main/java/com/fr/design/actions/community/QuestionAction.java

@ -1,13 +1,23 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import javax.swing.*;
import javax.swing.KeyStroke;
public class QuestionAction extends AbstractDesignerSSO {
/**
* 云中心问答页在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Question";
/**
* 云中心问答页默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Question_Default";
public QuestionAction() {
this.setMenuKeySet(QUESTIONS);
this.setName(getMenuKeySet().getMenuName());
@ -18,7 +28,7 @@ public class QuestionAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.questions", "http://bbs.fanruan.com/wenda");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY ,PROPS_LINK_KEY_DEFAULT);
}
public static final MenuKeySet QUESTIONS = new MenuKeySet() {

17
designer-base/src/main/java/com/fr/design/actions/community/SignAction.java

@ -1,14 +1,23 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import javax.swing.*;
import javax.swing.KeyStroke;
public class SignAction extends AbstractDesignerSSO {
/**
* 云中心认证落地页在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Aut";
/**
* 云中心认证落地页默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Aut_Default";
public SignAction() {
this.setMenuKeySet(SIGN);
this.setName(getMenuKeySet().getMenuName());
@ -18,7 +27,7 @@ public class SignAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.aut", "https://bbs.fanruan.com/certification/");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY ,PROPS_LINK_KEY_DEFAULT);
}
public static final MenuKeySet SIGN = new MenuKeySet() {

15
designer-base/src/main/java/com/fr/design/actions/community/StudyPlanAction.java

@ -1,10 +1,21 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.general.CloudCenter;
public class StudyPlanAction extends AbstractDesignerSSO {
/**
* 云中心帆软学院在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Study";
/**
* 云中心帆软学院默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Study_Default";
public StudyPlanAction() {
this.setName(Toolkit.i18nText("Fine-Design_Study_Plan"));
this.setSmallIcon("/com/fr/design/images/bbs/studyPlan");
@ -12,6 +23,6 @@ public class StudyPlanAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.studyPlan", "https://edu.fanruan.com/studypath/finereport");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY ,PROPS_LINK_KEY_DEFAULT);
}
}

15
designer-base/src/main/java/com/fr/design/actions/community/TechSolutionAction.java

@ -1,8 +1,8 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import javax.swing.KeyStroke;
@ -10,6 +10,17 @@ import javax.swing.KeyStroke;
* Created by XINZAI on 2018/8/23.
*/
public class TechSolutionAction extends AbstractDesignerSSO {
/**
* 云中心社区在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Community";
/**
* 云中心社区默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Community_Default";
public TechSolutionAction() {
this.setMenuKeySet(TSO);
this.setName(getMenuKeySet().getMenuName());
@ -20,7 +31,7 @@ public class TechSolutionAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.solution", "http://bbs.fanruan.com/forum-113-1.html");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY ,PROPS_LINK_KEY_DEFAULT);
}
public static final MenuKeySet TSO = new MenuKeySet() {

19
designer-base/src/main/java/com/fr/design/actions/community/TemplateStoreAction.java

@ -1,21 +1,28 @@
package com.fr.design.actions.community;
import com.fr.base.BaseUtils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import javax.swing.KeyStroke;
import java.awt.event.ActionEvent;
/**
* created by Harrison on 2020/03/24
**/
public class TemplateStoreAction extends AbstractDesignerSSO {
/**
* 云中心组件商城模板在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Market_Template";
/**
* 云中心组件商城模板默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Market_Template_Default";
public TemplateStoreAction() {
this.setMenuKeySet(TEMPLATE);
@ -47,6 +54,6 @@ public class TemplateStoreAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
ComponentCollector.getInstance().collectTepMenuEnterClick();
return CloudCenter.getInstance().acquireUrlByKind("design.market.template", "https://market.fanruan.com/template");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY ,PROPS_LINK_KEY_DEFAULT);
}
}

14
designer-base/src/main/java/com/fr/design/actions/community/UpAction.java

@ -1,14 +1,24 @@
package com.fr.design.actions.community;
import com.fr.base.BaseUtils;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import javax.swing.KeyStroke;
public class UpAction extends AbstractDesignerSSO {
/**
* 云中心工单中心在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Bbs_Update";
/**
* 云中心工单中心默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Bbs_Update_Default";
public UpAction() {
this.setMenuKeySet(UPDATE);
this.setName(getMenuKeySet().getMenuName());
@ -18,7 +28,7 @@ public class UpAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.update", "http://bbs.fanruan.com/forum.php?mod=collection&action=view&ctid=10");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY ,PROPS_LINK_KEY_DEFAULT);
}
public static final MenuKeySet UPDATE = new MenuKeySet() {

15
designer-base/src/main/java/com/fr/design/actions/community/WorkOrderCenterAction.java

@ -1,7 +1,7 @@
package com.fr.design.actions.community;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.general.CloudCenter;
/**
* @Description 工单中心
@ -9,6 +9,17 @@ import com.fr.general.CloudCenter;
* @Date 2021/3/8 14:02
**/
public class WorkOrderCenterAction extends UpAction {
/**
* 云中心工单中心在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Work_Order_Center";
/**
* 云中心工单中心默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Work_Order_Center_Default";
public WorkOrderCenterAction() {
this.setSmallIcon("/com/fr/design/images/bbs/workOrderCenter");
this.setName(Toolkit.i18nText("Fine-Design_Basic_Commuinity_Work_Order_Center"));
@ -16,6 +27,6 @@ public class WorkOrderCenterAction extends UpAction {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind("bbs.work.order.center", "https://service.fanruan.com/ticket");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
}

2
designer-base/src/main/java/com/fr/design/actions/edit/CopyAction.java

@ -21,7 +21,7 @@ public class CopyAction extends TemplateComponentAction {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Copy"));
this.setMnemonic('C');
this.setSmallIcon("/com/fr/design/images/m_edit/copy");
this.setSmallIcon("/com/fr/design/standard/copy/copy");
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, DEFAULT_MODIFIER));
this.setEnabled(!DesignModeContext.isBanCopyAndCut());
}

2
designer-base/src/main/java/com/fr/design/actions/edit/CutAction.java

@ -25,7 +25,7 @@ public class CutAction extends TemplateComponentAction {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_M_Edit_Cut"));
this.setMnemonic('T');
this.setSmallIcon("/com/fr/design/images/m_edit/cut");
this.setSmallIcon("/com/fr/design/standard/cut/cut");
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, DEFAULT_MODIFIER));
this.setEnabled(!DesignModeContext.isBanCopyAndCut());
}

2
designer-base/src/main/java/com/fr/design/actions/edit/PasteAction.java

@ -24,7 +24,7 @@ public class PasteAction extends TemplateComponentAction {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Edit_Paste"));
this.setMnemonic('P');
this.setSmallIcon("/com/fr/design/images/m_edit/paste");
this.setSmallIcon("/com/fr/design/standard/paste/paste");
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, DEFAULT_MODIFIER));
}

2
designer-base/src/main/java/com/fr/design/actions/file/DelFileAction.java

@ -22,7 +22,7 @@ public class DelFileAction extends UpdateAction {
public DelFileAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove"));
this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/remove");
this.setSmallIcon("/com/fr/design/standard/remove/remove");
}
@Override

2
designer-base/src/main/java/com/fr/design/actions/file/LocateAction.java

@ -28,7 +28,7 @@ public class LocateAction extends UpdateAction {
public LocateAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Locate"));
this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/locate.png");
this.setSmallIcon("/com/fr/design/standard/locate/locate");
}
@Override

3
designer-base/src/main/java/com/fr/design/actions/file/PreferenceAction.java

@ -40,7 +40,8 @@ public class PreferenceAction extends UpdateAction {
DesignerEnvManager.loadLogSetting();
DesignerEnvManager.getEnvManager().saveXMLFile();
JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jt != null) {
//不能只单纯判断!=null,JTemplate还有可能是JNullTemplate.NULL,这个时候模板也是空内容的
if (JTemplate.isValid(jt)) {
jt.refreshToolArea();
}
preferencePane.showRestartDialog();

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

@ -62,7 +62,7 @@ public class RenameAction extends UpdateAction {
public RenameAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Rename"));
this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/rename");
this.setSmallIcon("/com/fr/design/standard/rename/rename");
}
@Override

2
designer-base/src/main/java/com/fr/design/actions/file/SwitchExistEnv.java

@ -68,7 +68,7 @@ public class SwitchExistEnv extends MenuDef {
EnvChangeEntrance.getInstance().chooseEnv(envName);
} else {
SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(true);
if (saveSomeTemplatePane.showSavePane()) {
if (saveSomeTemplatePane.showSavePane(true)) {
// 用户模板保存后,才进行切换目录操作
EnvChangeEntrance.getInstance().switch2Env(envName);
}

14
designer-base/src/main/java/com/fr/design/actions/help/TutorialAction.java

@ -1,9 +1,9 @@
package com.fr.design.actions.help;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.login.AbstractDesignerSSO;
import com.fr.design.menu.MenuKeySet;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.general.http.HttpToolbox;
import com.fr.stable.CommonUtils;
@ -18,6 +18,16 @@ import java.awt.event.KeyEvent;
public class TutorialAction extends AbstractDesignerSSO {
/**
* 云中心社区帮助文档在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Help";
/**
* 云中心社区帮助文档默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Help_Default";
public TutorialAction() {
this.setMenuKeySet(HELP_TUTORIAL);
this.setName(getMenuKeySet().getMenuName());
@ -28,7 +38,7 @@ public class TutorialAction extends AbstractDesignerSSO {
@Override
public String getJumpUrl() {
return CloudCenter.getInstance().acquireUrlByKind(createDocKey(), "http://help.finereport.com");
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
// 生成帮助文档 sitecenter key, help.zh_CN.10

67
designer-base/src/main/java/com/fr/design/constants/UIConstants.java

@ -4,14 +4,13 @@
package com.fr.design.constants;
import com.fr.base.svg.IconUtils;
import com.fr.base.svg.SVGIcon;
import com.fr.base.svg.SVGLoader;
import com.fr.general.IOUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.border.Border;
import java.awt.BasicStroke;
import java.awt.Color;
@ -154,53 +153,55 @@ public interface UIConstants {
public static final BufferedImage DRAG_BAR = IOUtils.readImage("com/fr/design/images/control/bar.png");
public static final BufferedImage DRAG_BAR_LIGHT = IOUtils.readImage("com/fr/design/images/control/bar-light.png");
public static final BufferedImage ARROW_NORTH = IOUtils.readImage("com/fr/design/images/control/up_arrow.png");
public static final BufferedImage ARROW_SOUTH = IOUtils.readImage("com/fr/design/images/control/down_arrow.png");
public static final BufferedImage ARROW_EAST = IOUtils.readImage("com/fr/design/images/control/east_arrow.png");
public static final BufferedImage ARROW_WEST = IOUtils.readImage("com/fr/design/images/control/west_arrow.png");
public static final Image ARROW_NORTH = SVGLoader.load("/com/fr/design/standard/arrowlinear/up_arrow.svg");
public static final Image ARROW_SOUTH = SVGLoader.load("/com/fr/design/standard/arrowlinear/down_arrow.svg");
public static final Image ARROW_EAST = SVGLoader.load("/com/fr/design/standard/arrowlinear/east_arrow.svg");
public static final Image ARROW_WEST = SVGLoader.load("/com/fr/design/standard/arrowlinear/west_arrow.svg");
public static final BufferedImage DRAG_BAR_RIGHT = IOUtils.readImage("com/fr/design/images/control/barm.png");
public static final BufferedImage DRAG_BAR_LEFT = IOUtils.readImage("com/fr/design/images/control/barl.png");
public static final BufferedImage DRAG_UP_NORMAL = IOUtils.readImage("com/fr/design/images/control/upnor.png");
public static final BufferedImage DRAG_UP_PRESS = IOUtils.readImage("com/fr/design/images/control/uppre.png");
public static final BufferedImage DRAG_DOWN_NORMAL = IOUtils.readImage("com/fr/design/images/control/downnor.png");
public static final BufferedImage DRAG_DOWN_PRESS = IOUtils.readImage("com/fr/design/images/control/downpre.png");
public static final BufferedImage DRAG_RIGHT_NORMAL = IOUtils.readImage("com/fr/design/images/control/rightnor.png");
public static final BufferedImage DRAG_RIGHT_PRESS = IOUtils.readImage("com/fr/design/images/control/rightpre.png");
public static final BufferedImage DRAG_LEFT_NORMAL = IOUtils.readImage("com/fr/design/images/control/leftnor.png");
public static final BufferedImage DRAG_LEFT_PRESS = IOUtils.readImage("com/fr/design/images/control/leftpre.png");
public static final Image DRAG_UP_NORMAL = SVGLoader.load("/com/fr/design/standard/triangle.arrow/up_normal.svg");
public static final Image DRAG_UP_PRESS = SVGLoader.load("/com/fr/design/standard/triangle.arrow/up_hover.svg");
public static final Image DRAG_DOWN_NORMAL = SVGLoader.load("/com/fr/design/standard/triangle.arrow/down_normal.svg");
public static final Image DRAG_DOWN_PRESS = SVGLoader.load("/com/fr/design/standard/triangle.arrow/down_hover.svg");
public static final Image DRAG_RIGHT_NORMAL = SVGLoader.load("/com/fr/design/standard/drag/right_normal.svg");
public static final Image DRAG_RIGHT_PRESS = SVGLoader.load("/com/fr/design/standard/drag/right_pressed.svg");
public static final Image DRAG_LEFT_NORMAL = SVGLoader.load("/com/fr/design/standard/drag/left_normal.svg");
public static final Image DRAG_LEFT_PRESS = SVGLoader.load("/com/fr/design/standard/drag/left_pressed.svg");
public static final BufferedImage DRAG_DOT = IOUtils.readImage("com/fr/design/images/control/dot.png");
public static final BufferedImage DRAG_LINE = IOUtils.readImage("com/fr/design/images/control/dot-line.png");
public static final Image DRAG_LINE = SVGLoader.load("/com/fr/design/standard/dot_line_normal.svg");
public static final BufferedImage ACCESSIBLE_EDITOR_DOT = IOUtils.readImage("com/fr/design/images/control/dot.png");
public static final BufferedImage DRAG_DOT_VERTICAL = IOUtils.readImage("com/fr/design/images/control/dotv.png");
public static final BufferedImage POP_BUTTON_DOWN = IOUtils.readImage("com/fr/design/images/buttonicon/popdownarrow.png");
public static final BufferedImage POP_BUTTON_UP = IOUtils.readImage("com/fr/design/images/buttonicon/popuparrow.png");
public static final Image POP_BUTTON_DOWN = SVGLoader.load("/com/fr/design/standard/poparrow/pop_down_arrow.svg");
public static final Image POP_BUTTON_UP = SVGLoader.load("/com/fr/design/standard/poparrow/pop_up_arrow.svg");
public static final BufferedImage DRAG_DOWN_SELECTED_SMALL = IOUtils.readImage("com/fr/design/images/buttonicon/downSelected.png");
public static final BufferedImage DRAG_LEFT_NORMAL_SMALL = IOUtils.readImage("com/fr/design/images/buttonicon/leftNormal.png");
public static final BufferedImage WATERMARK_BACKGROUND = IOUtils.readImage("/com/fr/design/images/dialog/watermark/" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_WaterMark_Background_Icon_File_Name"));
public static final int MODEL_NORMAL = 0;
public static final int MODEL_PRESS = 1;
public static final Icon ARROW_DOWN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/arrowdown.png");
public static final Icon ARROW_DOWN_ICON = IconUtils.readIcon("/com/fr/design/standard/arrowlinear/down_arrow.svg");
public static final Icon ARROW_UP_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/arrowup.png");
public static final Icon YES_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/yes.png");
public static final Icon CHOOSEN_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/select_item.png");
public static final Icon PRE_WIDGET_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/prewidget.png");
public static final Icon PRE_WIDGET_NORMAL_ICON = IconUtils.readIcon("com/fr/design/images/buttonicon/prewidget");
public static final Icon EDIT_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editn.png");
public static final Icon EDIT_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/editp.png");
public static final Icon HIDE_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/hiden.png");
public static final Icon HIDE_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/hidep.png");
public static final Icon VIEW_NORMAL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/viewn.png");
public static final Icon VIEW_PRESSED_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/viewp.png");
public static final Icon RUN_BIG_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/run24.png");
public static final Icon RUN_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/runs.png");
public static final Icon PAGE_BIG_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/pageb24.png");
public static final Icon WRITE_BIG_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/writeb24.png");
public static final Icon ANA_BIG_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/anab24.png");
public static final Icon PAGE_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/pages.png");
public static final Icon WRITE_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/writes.png");
public static final Icon ANA_SMALL_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/anas.png");
public static final Icon EDIT_NORMAL_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/edit");
public static final Icon EDIT_PRESSED_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/edit_pressed.svg");
public static final Icon HIDE_NORMAL_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/hide");
public static final Icon HIDE_PRESSED_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/hide_pressed.svg");
public static final Icon VIEW_NORMAL_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/view");
//public static final Icon VIEW_PRESSED_ICON = IconUtils.readIcon("/com/fr/design/standard/uimode/view");
public static final Icon RUN_BIG_ICON = IconUtils.readIcon("/com/fr/design/standard/preview/run24.svg");
public static final Icon RUN_SMALL_ICON = IconUtils.readIcon("/com/fr/design/standard/preview/runs.svg");
public static final Icon PAGE_BIG_ICON = IconUtils.readIcon("/com/fr/design/standard/preview/pageb24.svg");
public static final Icon WRITE_BIG_ICON = IconUtils.readIcon("/com/fr/design/standard/preview/writeb24.svg");
public static final Icon ANA_BIG_ICON = IconUtils.readIcon("/com/fr/design/standard/preview/anab24.svg");
public static final Icon PAGE_SMALL_ICON = IconUtils.readIcon("/com/fr/design/standard/preview/pages.svg");
public static final Icon WRITE_SMALL_ICON = IconUtils.readIcon("/com/fr/design/standard/preview/writes.svg");
public static final Icon ANA_SMALL_ICON = IconUtils.readIcon("/com/fr/design/standard/preview/anas.svg");
public static final Icon REFRESH_ICON = IOUtils.readIcon("com/fr/design/images/buttonicon/refresh.png");
public static final Icon FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/foreground.png");
public static final Icon AUTO_FONT_ICON = IOUtils.readIcon("/com/fr/design/images/gui/color/autoForeground.png");
@ -220,7 +221,7 @@ public interface UIConstants {
public static final int BUTTON_GROUP_ARC = 0;
public static final int LARGEARC = 6;
public static final Stroke BS = new BasicStroke(1f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 2f, new float[]{3, 1}, 0);
public static final Icon PREVIEW_DOWN = IOUtils.readIcon("com/fr/design/images/buttonicon/prevew_down_icon.png");
public static final Icon PREVIEW_DOWN = IconUtils.readIcon("/com/fr/design/standard/preview_down_icon");
public static final Icon CLOSE_OF_AUTHORITY = IOUtils.readIcon("/com/fr/design/images/m_report/close.png");
public static final Icon CLOSE_OVER_AUTHORITY = IOUtils.readIcon("/com/fr/design/images/m_report/close_over.png");
public static final Icon CLOSE_PRESS_AUTHORITY = IOUtils.readIcon("/com/fr/design/images/m_report/close_press.png");

53
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -2,16 +2,20 @@ package com.fr.design.data;
import com.fr.base.BaseUtils;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.data.MultiResultTableData;
import com.fr.data.TableDataSource;
import com.fr.data.impl.DBTableData;
import com.fr.design.DesignModelAdapter;
import com.fr.design.actions.UpdateAction;
import com.fr.design.data.datapane.TableDataCreatorProducer;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.data.datapane.TableDataSourceOP;
import com.fr.design.data.datapane.TableDataTree;
import com.fr.design.data.datapane.auth.TableDataAuthHelper;
import com.fr.design.data.tabledata.ResponseDataSourceChange;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.loading.TableDataLoadingPane;
import com.fr.design.data.tabledata.wrapper.MultiResultTableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
@ -41,6 +45,8 @@ import javax.swing.DefaultCellEditor;
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JTree;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.tree.TreeCellEditor;
@ -50,6 +56,7 @@ import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.Collection;
import java.util.EventObject;
import java.util.HashMap;
import java.util.HashSet;
@ -114,7 +121,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
*/
@Override
public Icon getViewIcon() {
return BaseUtils.readIcon(IconPathConstants.DS_ICON_PATH);
return IconUtils.readIcon(IconPathConstants.DS_ICON_PATH);
}
/**
@ -424,7 +431,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
public PreviewTableDataAction(TableDataTree dataTree) {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"));
this.setMnemonic('p');
this.setSmallIcon("/com/fr/design/images/m_file/preview");
this.setSmallIcon("/com/fr/design/standard/previewdateset/preview");
this.dataTree = dataTree;
}
@ -448,7 +455,45 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
storeProcedureDataWrapper.previewData(MultiResultTableDataWrapper.PREVIEW_ALL);
}
} else {
((TableDataWrapper) data).previewData();
TableDataWrapper wrapper = ((TableDataWrapper) data);
if (TableDataAuthHelper.needCheckAuthWhenEdit(wrapper.getTableData())) {
// 先打开一个Loading面板
TableDataLoadingPane loadingPane = new TableDataLoadingPane();
BasicDialog loadingDialog = loadingPane.showLargeWindow(SwingUtilities.getWindowAncestor(BasicTableDataTreePane.this), null);
// 查询权限
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
// 获取无权限连接名称集合
Collection<String> noAuthConnections = TableDataAuthHelper.getNoAuthConnections();
// 获取当前数据集对应的数据连接名称
String connectionName = TableDataAuthHelper.getConnectionNameByDBTableData((DBTableData) wrapper.getTableData());
return !noAuthConnections.contains(connectionName);
}
@Override
protected void done() {
try {
Boolean hasAuth = get();
if (hasAuth) {
// 有权限时,关闭Loading面板,打开编辑面板
loadingDialog.setVisible(false);
wrapper.previewData();
} else {
// 无权限时,给出无权限提示
loadingPane.switchTo(TableDataLoadingPane.NO_AUTH_PANE_NAME);
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error("loading connection error in remote design", e.getMessage());
// 查询权限失败时,给出报错提示
loadingPane.switchTo(TableDataLoadingPane.ERROR_NAME);
}
}
}.execute();
loadingDialog.setVisible(true);
} else {
wrapper.previewData();
}
}
} catch (Exception ex) {
@ -463,7 +508,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
public ConnectionTableAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Define_Data_Connection"));
this.setMnemonic('D');
this.setSmallIcon("/com/fr/design/images/m_web/connection");
this.setSmallIcon("/com/fr/design/standard/connection", false);
}
@Override

3
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -32,6 +32,7 @@ import com.fr.file.TableDataConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.data.DataModel;
import com.fr.general.data.TableDataException;
import com.fr.general.sql.sqlnote.SqlNoteConstants;
import com.fr.log.FineLoggerFactory;
import com.fr.module.ModuleContext;
import com.fr.script.Calculator;
@ -571,6 +572,7 @@ public abstract class DesignTableDataManager {
parameter.setValue(parameterMap.get(parameter.getName()));
}
}
parameterMap.put(SqlNoteConstants.SQL_NOTE_TEMPLATE, HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath());
return DataOperator.getInstance().previewTableData(TableDataSourceTailor.extractTableData(tableDataSource), tabledata, parameterMap, rowCount);
} catch (Exception e) {
throw new TableDataException(e.getMessage(), e);
@ -667,6 +669,7 @@ public abstract class DesignTableDataManager {
if (needLoadingBar) {
MultiResultTableDataWrapper.loadingBar.start();
}
parameterMap.put(SqlNoteConstants.SQL_NOTE_TEMPLATE, HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getEditingFILE().getPath());
return DataOperator.getInstance().previewMultiResultTableData(tableData, parameterMap, 0);
}

16
designer-base/src/main/java/com/fr/design/data/datapane/ESDStrategyConfigPane.java

@ -6,6 +6,7 @@ import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.esd.common.CacheConstants;
@ -29,8 +30,8 @@ import java.net.URI;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Date;
import java.util.List;
/**
* @author rinoux
@ -38,7 +39,18 @@ import java.util.Date;
* Created by rinoux on 2020/7/22
*/
public class ESDStrategyConfigPane extends BasicBeanPane<StrategyConfig> {
private static final String CRON_HELP_URL = "http://help.fanruan.com/finereport/doc-view-693.html";
/**
* 云中心定时调度执行频率表达式设定帮助文档链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Cron_Help";
/**
* 云中心定时调度执行频率表达式设定帮助文档默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Cron_Help_Default";
private static final String CRON_HELP_URL = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
private UIRadioButton selectAutoUpdate;
private UIRadioButton selectBySchema;
private UICheckBox shouldEvolve;

28
designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java

@ -33,33 +33,33 @@ public class TableDataCreatorProducer {
public TableDataNameObjectCreator[] createReportTableDataCreator() {
TableDataNameObjectCreator dataBase = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Database_Query"),
"ds",
"/com/fr/design/images/data/database.png", DBTableData.class, DBTableDataPane.class);
"/com/fr/design/standard/database_normal.svg", DBTableData.class, DBTableDataPane.class);
TableDataNameObjectCreator ds_Class = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Class"),
"Class",
"/com/fr/design/images/data/source/classTableData.png", ClassTableData.class, ClassTableDataPane.class);
"/com/fr/design/standard/class_table_data_normal.svg", ClassTableData.class, ClassTableDataPane.class);
TableDataNameObjectCreator table = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Embedded"),
"Embedded",
"/com/fr/design/images/data/dataTable.png", EmbeddedTableData.class, EmbeddedTableDataPane.class);
"/com/fr/design/standard/data_table_normal.svg", EmbeddedTableData.class, EmbeddedTableDataPane.class);
TableDataNameObjectCreator multiTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Relation"),
"Multi",
"/com/fr/design/images/data/multi.png", ConditionTableData.class, MultiTDTableDataPane.class) {
"/com/fr/design/standard/multi_normal.svg", ConditionTableData.class, MultiTDTableDataPane.class) {
public boolean isNeedParameterWhenPopulateJControlPane() {
return true;
}
};
TableDataNameObjectCreator fileTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_File"),
"File",
"/com/fr/design/images/data/file.png", FileTableData.class, FileTableDataSmallHeightPane.class);
"/com/fr/design/standard/file_normal.svg", FileTableData.class, FileTableDataSmallHeightPane.class);
TableDataNameObjectCreator treeTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Tree"),
"Tree",
"/com/fr/design/images/data/tree.png", RecursionTableData.class, TreeTableDataPane.class) {
"/com/fr/design/standard/tree_normal.svg", RecursionTableData.class, TreeTableDataPane.class) {
public boolean isNeedParameterWhenPopulateJControlPane() {
return true;
}
};
TableDataNameObjectCreator storeProcedure = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Datasource_Stored_Procedure"),
"Proc",
"/com/fr/design/images/data/store_procedure.png",
"/com/fr/design/standard/store_procedure_normal.svg",
StoreProcedure.class, ProcedureDataPane.class) {
@Override
public boolean shouldInsertSeparator() {
@ -72,33 +72,33 @@ public class TableDataCreatorProducer {
public TableDataNameObjectCreator[] createServerTableDataCreator() {
TableDataNameObjectCreator dataBase = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Database_Query"),
"/com/fr/design/images/data/dock/serverdatabase.png", DBTableData.class,
"/com/fr/design/standard/server_database_normal.svg", DBTableData.class,
DBTableDataPane.class);
TableDataNameObjectCreator ds_Class = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Class"),
"/com/fr/design/images/data/dock/serverclasstabledata.png", ClassTableData.class,
"/com/fr/design/standard/class_table_data_normal.svg", ClassTableData.class,
ClassTableDataPane.class);
TableDataNameObjectCreator table = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Embedded"),
"/com/fr/design/images/data/dock/serverdatatable.png", EmbeddedTableData.class,
"/com/fr/design/standard/data_table_normal.svg", EmbeddedTableData.class,
EmbeddedTableDataPane.class);
TableDataNameObjectCreator fileTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_File"),
"/com/fr/design/images/data/file.png", FileTableData.class,
"/com/fr/design/standard/file_normal.svg", FileTableData.class,
FileTableDataSmallPane.class);
TableDataNameObjectCreator treeTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Tree"),
"/com/fr/design/images/data/tree.png",
"/com/fr/design/standard/tree_normal.svg",
RecursionTableData.class, GlobalTreeTableDataPane.class) {
public boolean isNeedParameterWhenPopulateJControlPane() {
return true;
}
};
TableDataNameObjectCreator multiTable = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Relation"),
"/com/fr/design/images/data/multi.png",
"/com/fr/design/standard/multi_normal.svg",
ConditionTableData.class, GlobalMultiTDTableDataPane.class) {
public boolean isNeedParameterWhenPopulateJControlPane() {
return true;
}
};
TableDataNameObjectCreator storeProcedure = new TableDataNameObjectCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tabledata_Type_Stored_Procedure"),
"/com/fr/design/images/data/store_procedure.png",
"/com/fr/design/standard/store_procedure_normal.svg",
StoreProcedure.class, ProcedureDataPane.class) {
@Override
public boolean shouldInsertSeparator() {

12
designer-base/src/main/java/com/fr/design/data/datapane/TableDataNameObjectCreator.java

@ -1,6 +1,8 @@
package com.fr.design.data.datapane;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.base.svg.SVGLoader;
import com.fr.data.impl.DBTableData;
import com.fr.design.actions.tabledata.TableDataAction;
import com.fr.design.beans.BasicBeanPane;
@ -39,7 +41,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
public TableDataNameObjectCreator(TableDataAction action) {
super(action.getDisplayName(), action.getIconPath(), action.getTableDataClass(), action.getUpdateTableDataPaneClass());
this.iconPath = action.getIconPath();
menuImage = BaseUtils.readImage(iconPath);
menuImage = SVGLoader.load(iconPath);
isNeedInsertSeparator = action.isNeedInsertSeparator();
prefix = action.getPrefix();
}
@ -54,7 +56,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
super(menuName, iconPath, clazz, updatePane);
if (iconPath != null) {
this.iconPath = iconPath;
menuImage = BaseUtils.readImage(iconPath);
menuImage = SVGLoader.load(iconPath);
}
}
@ -62,7 +64,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
super(menuName, iconPath, clazz, updatePane);
if (iconPath != null) {
this.iconPath = iconPath;
menuImage = BaseUtils.readImage(iconPath);
menuImage = SVGLoader.load(iconPath);
}
this.prefix = prefix;
}
@ -71,7 +73,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
super(menuName, iconPath, clazz, clazz4Init, updatePane);
if (iconPath != null) {
this.iconPath = iconPath;
menuImage = BaseUtils.readImage(iconPath);
menuImage = SVGLoader.load(iconPath);
}
}
@ -79,7 +81,7 @@ public class TableDataNameObjectCreator extends NameObjectCreator {
super(menuName, iconPath, clazz, clazz4Init, updatePane);
if (iconPath != null) {
this.iconPath = iconPath;
menuImage = BaseUtils.readImage(iconPath);
menuImage = SVGLoader.load(iconPath);
}
this.prefix = prefix;
}

13
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTree.java

@ -1,10 +1,9 @@
package com.fr.design.data.datapane;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.data.MultiResultTableData;
import com.fr.design.constants.UIConstants;
import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager;
import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.gui.itree.refreshabletree.UserObjectRefreshJTree;
@ -55,7 +54,7 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
Object userObj = treeNode.getUserObject();
if (userObj instanceof String) {
// p:这个是column field.
this.setIcon(BaseUtils.readIcon("com/fr/design/images/data/field.png"));
this.setIcon(IconUtils.readIcon("/com/fr/design/standard/field"));
this.setText((String) userObj);
} else if (userObj instanceof NameObject) {
NameObject nameObject = (NameObject) userObj;
@ -66,14 +65,14 @@ public class TableDataTree extends UserObjectRefreshJTree<TableDataSourceOP> {
} else if (nameObject.getObject() instanceof Integer) {
int num = (Integer) nameObject.getObject();
if (num == TableDataSourceOP.SERVER_TABLE_DATA) {
this.setIcon(BaseUtils.readIcon(IconPathConstants.STD_SHOW_ICON_PATH));
this.setIcon(IconUtils.readIcon(IconPathConstants.STD_SHOW_ICON_PATH));
} else if (num == TableDataSourceOP.STORE_PRECEDURE_DATA) {
this.setIcon(BaseUtils.readIcon(IconPathConstants.SP_SHOW_ICON_PATH));
this.setIcon(IconUtils.readIcon(IconPathConstants.SP_SHOW_ICON_PATH));
} else {
this.setIcon(BaseUtils.readIcon(IconPathConstants.DS_QUERY_ICON_PATH));
this.setIcon(IconUtils.readIcon(IconPathConstants.DS_QUERY_ICON_PATH));
}
} else {
this.setIcon(BaseUtils.readIcon("/com/fr/design/images/data/store_procedure.png"));
this.setIcon(IconUtils.readIcon("/com/fr/design/images/data/store_procedure.png"));
}
} else if (userObj == PENDING) {
this.setIcon(null);

14
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -229,7 +229,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
private TreeSearchToolbarPane initToolBarPane() {
// toolbar
addMenuDef = new MenuDef(Toolkit.i18nText("Fine-Design_Basic_Action_Add"));
addMenuDef.setIconPath("/com/fr/design/images/control/addPopup");
addMenuDef.setDisabledIcon("/com/fr/design/standard/addpopup/addPopup", true);
createAddMenuDef();
// 创建插件监听
createPluginListener();
@ -895,7 +895,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
@Override
public String getIconResource() {
return "/com/fr/design/images/control/batch_esd_on";
return "/com/fr/design/standard/batchesdon/batch_esd_on";
}
@Override
@ -942,7 +942,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
@Override
public String getIconResource() {
return "/com/fr/design/images/control/batch_esd_off";
return "/com/fr/design/standard/batchesdoff/batch_esd_off";
}
@Override
@ -1036,7 +1036,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public EditAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Edit"));
this.setMnemonic('E');
this.setSmallIcon("/com/fr/design/images/control/edit");
this.setSmallIcon("/com/fr/design/standard/editdataset/edit");
}
@Override
@ -1101,7 +1101,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public RemoveAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Remove"));
this.setMnemonic('R');
this.setSmallIcon("/com/fr/design/images/control/remove");
this.setSmallIcon("/com/fr/design/standard/remove/remove");
}
@Override
@ -1177,7 +1177,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public CopyAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Copy"));
this.setMnemonic('C');
this.setSmallIcon("/com/fr/design/images/m_edit/copy");
this.setSmallIcon("/com/fr/design/standard/copy/copy");
}
@Override
@ -1227,7 +1227,7 @@ public class TableDataTreePane extends BasicTableDataTreePane {
public SwitchAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Search"));
this.setMnemonic('S');
this.setSmallIcon("/com/fr/design/images/data/search");
this.setSmallIcon("/com/fr/design/standard/search", false);
}
@Override

3
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionTableProcedurePane.java

@ -21,6 +21,7 @@ import com.fr.general.GeneralContext;
import com.fr.stable.ArrayUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JPanel;
import javax.swing.ToolTipManager;
import javax.swing.event.DocumentEvent;
@ -109,6 +110,8 @@ public class ConnectionTableProcedurePane extends BasicPane {
if (parent != null) {
parent.switchTo(SwitchableTableDataPane.CONTENT_PANE_NAME);
}
DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel());
model.removeElement(EMPTY);
}
@Override

4
designer-base/src/main/java/com/fr/design/data/datapane/management/search/pane/TreeSearchToolbarPane.java

@ -103,7 +103,7 @@ public class TreeSearchToolbarPane extends JPanel implements TreeSearchStatusCha
searchPane.setBorder(BorderFactory.createLineBorder(UIConstants.TOOLBAR_BORDER_COLOR));
searchPane.setBackground(Color.WHITE);
// 左侧搜索图标
UILabel searchLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/data/search"));
UILabel searchLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/search"));
searchLabel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
searchLabel.addMouseListener(new MouseAdapter() {
@Override
@ -149,7 +149,7 @@ public class TreeSearchToolbarPane extends JPanel implements TreeSearchStatusCha
});
this.searchTextField.addKeyListener(enterPressed);
// 右侧返回图标
UILabel returnLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/data/clear"));
UILabel returnLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/clear"));
returnLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Tree_Search_Return"));
returnLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 11));
returnLabel.addMouseListener(new MouseAdapter() {

7
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/common/DesensitizationOpenPane.java

@ -8,10 +8,12 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.VerticalFlowLayout;
import com.fr.design.locale.impl.DataMaskMark;
import com.fr.general.locale.LocaleCenter;
import com.fr.general.locale.LocaleMark;
import com.fr.log.FineLoggerFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -58,7 +60,8 @@ public class DesensitizationOpenPane extends JPanel {
@Override
public void mouseClicked(MouseEvent event) {
try {
URL url = new URL(Toolkit.i18nText("Fine-Design_Report_Desensitization_Help_Document_Url"));
LocaleMark<String> dataMaskMark = LocaleCenter.getMark(DataMaskMark.class);
URL url = new URL(dataMaskMark.getValue());
Desktop.getDesktop().browse(url.toURI());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, "open browse of table data desensitization help document failed for {}", e.getMessage());

15
designer-base/src/main/java/com/fr/design/data/datapane/preview/desensitization/view/rule/DesensitizationRuleChoosePane.java

@ -12,6 +12,7 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itableeditorpane.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.gui.itableeditorpane.UITableModelAdapter;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.Toolkit;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.CollectionUtils;
@ -25,6 +26,7 @@ import javax.swing.table.TableCellRenderer;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.util.LinkedHashSet;
import java.util.List;
@ -177,6 +179,15 @@ public class DesensitizationRuleChoosePane extends JPanel {
.collect(Collectors.toSet());
}
/**
* 根据语言环境获取规则编辑页面的宽高
*
* @return
*/
private Dimension getRuleEditPaneDimensionByLocale() {
return DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.data.datapane.preview.desensitization.view.rule.DesensitizationRuleChoosePane.ruleEditPane");
}
/**
* 规则状态展示页面
*/
@ -256,7 +267,7 @@ public class DesensitizationRuleChoosePane extends JPanel {
public void doCancel() {
super.doCancel();
}
}, BasicDialog.DEFAULT);
}, getRuleEditPaneDimensionByLocale());
basicDialog.setVisible(true);
}
}
@ -301,7 +312,7 @@ public class DesensitizationRuleChoosePane extends JPanel {
public void doCancel() {
super.doCancel();
}
}, BasicDialog.DEFAULT);
}, getRuleEditPaneDimensionByLocale());
basicDialog.setVisible(true);
}
}

14
designer-base/src/main/java/com/fr/design/data/datapane/preview/sql/PreviewPerformedSqlPane.java

@ -11,12 +11,12 @@ import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.injectable.PluginModule;
@ -63,6 +63,16 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
private UILabel imageLabel;
/**
* 云中心防止sql注入帮助文档链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design_Basic_Sql_Injection_Prevention_Help";
/**
* 云中心防止sql注入帮助文档默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design_Basic_Sql_Injection_Prevention_Help_Default";
public PreviewPerformedSqlPane(Frame frame, String sql) {
this(frame, sql, null, null, false);
}
@ -84,7 +94,7 @@ public class PreviewPerformedSqlPane extends JDialog implements ActionListener {
JLabel label = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Preview_Performed_Sql_Message") + Toolkit.i18nText("Fine-Design_Basic_Sql_Injection_Prevention") + Toolkit.i18nText("Fine-Design_Basic_Preview_Special_Char_Sql_Back_Message"));
messagePanel.add(label);
} else {
MessageWithLink message = new MessageWithLink(Toolkit.i18nText("Fine-Design_Basic_Preview_Special_Char_Sql_Front_Message"), Toolkit.i18nText("Fine-Design_Basic_Sql_Injection_Prevention"), CloudCenter.getInstance().acquireConf(Toolkit.i18nText("Fine-Design_Basic_Sql_Injection_Prevention_Help"), "https://help.fanruan.com/finereport/doc-view-2219.html"), Toolkit.i18nText("Fine-Design_Basic_Preview_Special_Char_Sql_Back_Message"));
MessageWithLink message = new MessageWithLink(Toolkit.i18nText("Fine-Design_Basic_Preview_Special_Char_Sql_Front_Message"), Toolkit.i18nText("Fine-Design_Basic_Sql_Injection_Prevention"), LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT), Toolkit.i18nText("Fine-Design_Basic_Preview_Special_Char_Sql_Back_Message"));
messagePanel.add(message);
}
// 提示图标

8
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapperHelper.java

@ -1,6 +1,7 @@
package com.fr.design.data.tabledata.wrapper;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.design.data.datapane.TableDataCreatorProducer;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.fun.ServerTableDataDefineProvider;
@ -8,7 +9,6 @@ import com.fr.design.fun.TableDataDefineProvider;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.IOUtils;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.Filter;
@ -25,7 +25,7 @@ import java.util.Map;
*/
class MultiResultTableDataWrapperHelper {
private static final Map<Class<? extends TableData>, Icon> TABLE_DATA_ICON_PATHS = new HashMap<>();
private static final String DEFAULT_MULTI_RESULT_TD_ICON = "/com/fr/design/images/data/multi.png";
private static final String DEFAULT_MULTI_RESULT_TD_ICON = "/com/fr/design/standard/multi";
static {
@ -45,10 +45,10 @@ class MultiResultTableDataWrapperHelper {
return TABLE_DATA_ICON_PATHS.computeIfAbsent(tableDataClass, cls -> {
for (TableDataNameObjectCreator creator : TableDataCreatorProducer.getInstance().createReportTableDataCreator()) {
if (creator.createObject().getClass().isAssignableFrom(tableDataClass)) {
return IOUtils.readIcon(creator.getIconPath());
return IconUtils.readIcon(creator.getIconPath());
}
}
return IOUtils.readIcon(DEFAULT_MULTI_RESULT_TD_ICON);
return IconUtils.readIcon(DEFAULT_MULTI_RESULT_TD_ICON);
});
}
}

22
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/ServerTableDataWrapper.java

@ -2,6 +2,8 @@ package com.fr.design.data.tabledata.wrapper;
import com.fr.base.BaseUtils;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.base.svg.SVGLoader;
import com.fr.data.impl.ClassTableData;
import com.fr.data.impl.DBTableData;
import com.fr.data.impl.EmbeddedTableData;
@ -24,20 +26,22 @@ public final class ServerTableDataWrapper extends AbstractTableDataWrapper {
@Override
public Icon getIcon() {
if (tabledata instanceof DBTableData) {
if (StringUtils.isBlank(((DBTableData) tabledata).getQuery()))
return new WarningIcon(BaseUtils.readImage("/com/fr/design/images/data/dock/serverdatabase.png"));
else
return BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase.png");
if (StringUtils.isBlank(((DBTableData) tabledata).getQuery())) {
return new WarningIcon(SVGLoader.load("/com/fr/design/standard/server_database_normal.svg"));
}
else {
return IconUtils.readIcon("/com/fr/design/standard/server_database");
}
} else if (tabledata instanceof ClassTableData) {
return BaseUtils.readIcon("/com/fr/design/images/data/dock/serverclasstabledata.png");
return IconUtils.readIcon("/com/fr/design/standard/class_table_data");
} else if (tabledata instanceof EmbeddedTableData) {
return BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatatable.png");
return IconUtils.readIcon("/com/fr/design/standard/data_table");
}else if(tabledata instanceof RecursionTableData){
return BaseUtils.readIcon("/com/fr/design/images/data/tree.png");
return IconUtils.readIcon("/com/fr/design/standard/tree");
} else if (tabledata instanceof StoreProcedure) {
return BaseUtils.readIcon("/com/fr/design/images/data/store_procedure.png");
return IconUtils.readIcon("/com/fr/design/standard/store_procedure");
}
return BaseUtils.readIcon("/com/fr/design/images/data/dock/serverdatabase.png");
return IconUtils.readIcon("/com/fr/design/standard/server_database");
}
/**

4
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureDataWrapper.java

@ -1,7 +1,7 @@
package com.fr.design.data.tabledata.wrapper;
import com.fr.base.BaseUtils;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.operator.DataOperator;
@ -150,7 +150,7 @@ public final class StoreProcedureDataWrapper implements TableDataWrapper {
@Override
public Icon getIcon() {
return BaseUtils.readIcon("/com/fr/design/images/data/store_procedure.png");
return IconUtils.readIcon("/com/fr/design/standard/store_procedure");
}
/**

4
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/StoreProcedureNameWrapper.java

@ -1,7 +1,7 @@
package com.fr.design.data.tabledata.wrapper;
import com.fr.base.BaseUtils;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.data.impl.storeproc.ProcedureDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.design.data.DesignTableDataManager;
@ -71,7 +71,7 @@ public final class StoreProcedureNameWrapper implements TableDataWrapper {
@Override
public Icon getIcon() {
return BaseUtils.readIcon("/com/fr/design/images/data/store_procedure.png");
return IconUtils.readIcon("/com/fr/design/standard/store_procedure");
}
private void createStore(boolean needLoadingBar) {

20
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java

@ -55,15 +55,15 @@ public abstract class TableDataFactory {
* 同一类型的只能加一次,就加最上层的类,因为要排序如果将所有的 FileTableData都加进来那么FileTableData的排序就不正确了
*/
static {
defaultMap.put(DBTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/database.png", DBTableData.class, DBTableDataPane.class));
defaultMap.put(ClassTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/source/classTableData.png", ClassTableData.class, ClassTableDataPane.class));
defaultMap.put(EmbeddedTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/dataTable.png", EmbeddedTableData.class, EmbeddedTableDataPane.class));
defaultMap.put(DecoratedTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/multi.png", DecoratedTableData.class, DecoratedTableDataPane.class));
defaultMap.put(StoreProcedure.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/store_procedure.png", StoreProcedure.class, ProcedureDataPane.class));
defaultMap.put(MultiTDTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/multi.png", MultiTDTableData.class, MultiTDTableDataPane.class));
defaultMap.put(FileTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/file.png", FileTableData.class, FileTableDataPane.class));
defaultMap.put(RecursionTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/tree.png", RecursionTableData.class, TreeTableDataPane.class));
defaultMap.put(MultiFieldTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/images/data/database.png", MultiFieldTableData.class, null));
defaultMap.put(DBTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/database_normal.svg", DBTableData.class, DBTableDataPane.class));
defaultMap.put(ClassTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/class_table_data_normal.svg", ClassTableData.class, ClassTableDataPane.class));
defaultMap.put(EmbeddedTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/data_table_normal.svg", EmbeddedTableData.class, EmbeddedTableDataPane.class));
defaultMap.put(DecoratedTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/multi_normal.svg", DecoratedTableData.class, DecoratedTableDataPane.class));
defaultMap.put(StoreProcedure.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/store_procedure_normal.svg", StoreProcedure.class, ProcedureDataPane.class));
defaultMap.put(MultiTDTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/multi_normal.svg", MultiTDTableData.class, MultiTDTableDataPane.class));
defaultMap.put(FileTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/file_normal.svg", FileTableData.class, FileTableDataPane.class));
defaultMap.put(RecursionTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/tree_normal.svg", RecursionTableData.class, TreeTableDataPane.class));
defaultMap.put(MultiFieldTableData.class.getName(), new TableDataNameObjectCreator(null, "/com/fr/design/standard/database_normal.svg", MultiFieldTableData.class, null));
map.putAll(defaultMap);
}
@ -151,7 +151,7 @@ public abstract class TableDataFactory {
if (tableDataNameObjectCreator != null && tableDataNameObjectCreator.getIconPath() != null) {
return tableDataNameObjectCreator.getIconPath();
}
return "/com/fr/design/images/data/database.png";
return "/com/fr/design/standard/database_normal.svg";
}
/**

7
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TemplateTableDataWrapper.java

@ -2,8 +2,9 @@ package com.fr.design.data.tabledata.wrapper;
import javax.swing.Icon;
import com.fr.base.BaseUtils;
import com.fr.base.TableData;
import com.fr.base.svg.IconUtils;
import com.fr.base.svg.SVGLoader;
import com.fr.data.impl.DBTableData;
import com.fr.design.icon.WarningIcon;
import com.fr.stable.StringUtils;
@ -20,9 +21,9 @@ public final class TemplateTableDataWrapper extends AbstractTableDataWrapper {
@Override
public Icon getIcon() {
if (tabledata instanceof DBTableData && StringUtils.isBlank(((DBTableData) tabledata).getQuery())) {
return new WarningIcon(BaseUtils.readImage("/com/fr/design/images/data/database.png"));
return new WarningIcon(SVGLoader.load("/com/fr/design/standard/database_normal.svg"));
}
return BaseUtils.readIcon(TableDataFactory.getIconPath(tabledata));
return IconUtils.readIcon(TableDataFactory.getIconPath(tabledata));
}
@Override

15
designer-base/src/main/java/com/fr/design/extra/exe/callback/handle/PluginCallBackHelper.java

@ -2,6 +2,7 @@ package com.fr.design.extra.exe.callback.handle;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.error.PluginErrorCode;
import com.fr.plugin.manage.control.PluginTaskResult;
@ -16,7 +17,19 @@ public class PluginCallBackHelper {
private static final String REFERENCE = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_Reference");
private static final String HELP_DOCUMENT_NAME = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_HELP_DOCUMENT_NAME");
private static final String CONNECTOR = "-";
private static final String HELP_DOCUMENT_LINK = Toolkit.i18nText("Fine-Design_Basic_Plugin_File_Validate_HELP_DOCUMENT_LINK");
/**
* 云中心第三方插件安装失败说明帮助文档在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design_Basic_Plugin_File_Validate_HELP_DOCUMENT_LINK";
/**
* 云中心第三方插件安装失败说明帮助文档默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design_Basic_Plugin_File_Validate_HELP_DOCUMENT_LINK_Default";
private static final String HELP_DOCUMENT_LINK = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
/**

2
designer-base/src/main/java/com/fr/design/extra/exe/callback/handle/PluginTaskResultErrorDialog.java

@ -53,7 +53,7 @@ public class PluginTaskResultErrorDialog extends JDialog {
private void initContentPane() {
this.contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
// error图标
errorLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/system/error_tips.svg"));
errorLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/system/error_tips"));
errorLabel.setPreferredSize(LABEL);
errorLabel.setBorder(BorderFactory.createEmptyBorder(10, 20, 40, 20));
// 提示内容

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

@ -268,7 +268,8 @@ public class HistoryTemplateListCache implements CallbackEvent {
boolean replaceWithJVirtualTemplate = overTemplate.getEditingFILE().exists()
&& overTemplate.isALLSaved()
&& overTemplate != editingTemplate
&& overTemplate.checkEnable();
&& overTemplate.checkEnable()
&& overTemplate.supportCache();
if (replaceWithJVirtualTemplate) {
closeVirtualSelectedReport(overTemplate);
historyList.set(i, new JVirtualTemplate(overTemplate.getEditingFILE()));
@ -297,7 +298,9 @@ public class HistoryTemplateListCache implements CallbackEvent {
int index = iterator.nextIndex();
if (size == index + 1 && index > 0) {
//如果删除的是后一个Tab,则定位到前一个
MultiTemplateTabPane.getInstance().setSelectedIndex(index - 1);
MultiTemplateTabPane.getInstance().setSelectedIndex(
MultiTemplateTabPane.getInstance().calNextShowJTemplateIndex(index - 1));
}
}
}

349
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabMenuFactory.java

@ -0,0 +1,349 @@
package com.fr.design.file;
import com.fr.base.svg.IconUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.gui.imenu.UIScrollPopUpMenu;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.TemplateUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.collections.CollectionUtils;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 右侧下拉菜单的工厂类
* @author Carlson
* @since 11.0
* created on 2023-04-14
**/
public class MultiTemplateTabMenuFactory {
private static final Icon CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close");
private static final Icon MOUSE_OVER_CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close_mouseover.svg");
private static final Icon MOUSE_PRESS_CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close_press.svg");
private static final int ITEM_SIZE = 25;
private UIScrollPopUpMenu menu = null;
private static MultiTemplateTabMenuFactory INSTANCE = new MultiTemplateTabMenuFactory();
private MultiTemplateTabMenuFactory() {
}
/**
* 返回右侧下拉菜单的工厂类
* @return
*/
public static MultiTemplateTabMenuFactory getInstance() {
return INSTANCE;
}
/**
* tab上的下拉菜单
*/
public UIScrollPopUpMenu createMenu() {
menu = new UIScrollPopUpMenu();
menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0));
menu.add(initCloseOther());
menu.add(createEmptyRow());
menu.addSeparator();
menu.add(createEmptyRow());
menu.add(createCategory(Toolkit.i18nText("Fine-Design_Basic_Tab_Current_Category_Templates")));
Component[] items = createCurrentCategory();
for (Component item : items) {
menu.add(item);
}
items = createOtherCategory();
if (items.length > 0) {
menu.addSeparator();
menu.add(createEmptyRow());
menu.add(createCategory(Toolkit.i18nText("Fine-Design_Basic_Tab_Other_Category_Templates")));
for (Component item : items) {
menu.add(item);
}
}
Dimension dimension = menu.getPreferredSize();
dimension.width += ITEM_SIZE;
menu.setPreferredSize(dimension);
return menu;
}
/**
* 关闭其它按钮
*/
private UIMenuItem initCloseOther() {
UIMenuItem closeOther = new UIMenuItem(Toolkit.i18nText("Fine-Design_Basic_Tab_Close_Other_Templates_Of_Current_Category"));
closeOther.setHorizontalAlignment(SwingConstants.CENTER);
Dimension dimension = closeOther.getPreferredSize();
dimension.height = ITEM_SIZE;
closeOther.setPreferredSize(dimension);
String currentOperator = getCurrentTabOperatorType();
closeOther.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
MultiTemplateTabPane.getInstance().closeOtherByOperatorType(currentOperator);
}
});
if (MultiTemplateTabPane.getInstance().getOpenedJTemplatesByOperator(currentOperator).size() <= 1) {
closeOther.setEnabled(false);
}
return closeOther;
}
/**
* 美观用
*/
private JPanel createEmptyRow() {
return new JPanel() {
@Override
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.height = 1;
return d;
}
};
}
/**
* 模板分类item
*/
private UIButton createCategory(String categoryName) {
UIButton button = new UIButton(categoryName);
button.setBorderPainted(false);
button.setExtraPainted(false);
button.setPreferredSize(new Dimension(menu.getWidth(), ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
button.setHorizontalAlignment(SwingConstants.LEFT);
button.setForeground(UIConstants.FLESH_BLUE);
return button;
}
/**
* 创建 当前分类模板 item数组
*/
private Component[] createCurrentCategory() {
return createListDownItem(MultiTemplateTabPane.getInstance().getOpenedJTemplatesByOperator(getCurrentTabOperatorType()));
}
private String getCurrentTabOperatorType(){
JTemplate jTemplate= HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return jTemplate.getTemplateTabOperatorType();
}
/**
* 创建 其它分类模板 item数组
*/
private Component[] createOtherCategory() {
String currentOperator = getCurrentTabOperatorType();
List<JTemplate<?, ?>> openedTemplates = new ArrayList<>();
Map<String, List<JTemplate<?, ?>>> map = MultiTemplateTabPane.getInstance().getOpenedJTemplatesByCategory();
for (Map.Entry<String, List<JTemplate<?, ?>>> entry : map.entrySet()) {
if (!StringUtils.equals(currentOperator, entry.getKey())) {
openedTemplates.addAll(entry.getValue());
}
}
return createListDownItem(openedTemplates);
}
/**
* 根据template列表创建多个item
*/
private Component[] createListDownItem(List<JTemplate<?, ?>> openedTemplates) {
if (!CollectionUtils.isEmpty(openedTemplates)) {
Component[] templates = new Component[openedTemplates.size()];
for (int i = 0; i < openedTemplates.size(); i++) {
templates[i] = createListDownMenuItem(openedTemplates.get(i));
}
return templates;
}
return new Component[0];
}
/**
* 根据template对象创建item
*/
private Component createListDownMenuItem(JTemplate<?, ?> template) {
JPanel jPanel = new JPanel();
jPanel.setPreferredSize(new Dimension(menu.getWidth(), ITEM_SIZE));
jPanel.setLayout(new BorderLayout());
MenuItemButtonGroup menuItemButtonGroup = new MenuItemButtonGroup(template);
if (template == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()) {
menuItemButtonGroup.templateButton.setForeground(UIConstants.FLESH_BLUE);
}
jPanel.add(menuItemButtonGroup.iconButton, BorderLayout.WEST);
jPanel.add(menuItemButtonGroup.templateButton, BorderLayout.CENTER);
jPanel.add(menuItemButtonGroup.closeButton, BorderLayout.EAST);
return jPanel;
}
/**
* menu的item由模板图标模板名模板关闭按钮组成
*/
private class MenuItemButtonGroup {
private final UIButton iconButton;
private final UIButton templateButton;
private final UIButton closeButton;
public MenuItemButtonGroup(JTemplate<?, ?> template) {
iconButton = createIconButton(template);
templateButton = createTemplateButton(template);
closeButton = createCloseButton();
initListener(template);
}
/**
* item[0] 模板图标按钮初始化
*/
private UIButton createIconButton(JTemplate<?, ?> template) {
UIButton button = new UIButton(template.getIcon(), template.getIcon(), template.getIcon());
button.setPreferredSize(new Dimension(ITEM_SIZE, ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
return button;
}
/**
* item[1] 切换模板按钮初始化
*/
private UIButton createTemplateButton(JTemplate<?, ?> template) {
UIButton button = new UIButton(TemplateUtils.createLockeTemplatedName(template, template.getTemplateName()));
button.setBorderPainted(false);
button.setExtraPainted(false);
button.setPreferredSize(new Dimension(menu.getWidth() - ITEM_SIZE * 2, ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
button.setHorizontalAlignment(SwingConstants.LEFT);
return button;
}
/**
* item[2] 关闭模板图标按钮初始化
*/
private UIButton createCloseButton() {
UIButton button = new UIButton(CLOSE, MOUSE_OVER_CLOSE, MOUSE_PRESS_CLOSE);
button.setPreferredSize(new Dimension(ITEM_SIZE, ITEM_SIZE));
button.setOpaque(true);
button.setBackground(UIConstants.NORMAL_BACKGROUND);
button.setVisible(false);
return button;
}
private void initListener(JTemplate<?, ?> template) {
initIconButtonListener();
initTemplateButtonListener(template);
initCloseButtonListener(template);
}
/**
* item[0] 模板图标按钮鼠标事件
*/
private void initIconButtonListener() {
iconButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* item[1] 切换模板按钮鼠标事件
*/
private void initTemplateButtonListener(JTemplate<?, ?> template) {
templateButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
menu.setVisible(false);
MultiTemplateTabPane.getInstance().switchJTemplate(template);
}
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* item[2] 关闭模板按钮鼠标事件
*/
private void initCloseButtonListener(JTemplate<?, ?> template) {
closeButton.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
menu.setVisible(false);
MultiTemplateTabPane.getInstance().setIsCloseCurrent(template == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate());
MultiTemplateTabPane.getInstance().closeFormat(template);
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(template);
}
@Override
public void mouseEntered(MouseEvent e) {
fireMouseEnteredEvent();
}
@Override
public void mouseExited(MouseEvent e) {
fireMouseExitedEvent();
}
});
}
/**
* mouse移入item范围
*/
private void fireMouseEnteredEvent() {
iconButton.setBackground(UIConstants.HOVER_BLUE);
templateButton.setBackground(UIConstants.HOVER_BLUE);
closeButton.setBackground(UIConstants.HOVER_BLUE);
closeButton.setVisible(true);
}
/**
* mouse移出item范围
*/
private void fireMouseExitedEvent() {
iconButton.setBackground(UIConstants.NORMAL_BACKGROUND);
templateButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND);
closeButton.setVisible(false);
}
}
}

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

@ -1,8 +1,8 @@
package com.fr.design.file;
import com.fr.base.BaseUtils;
import com.fr.base.GraphHelper;
import com.fr.base.svg.IconUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.file.LocateAction;
@ -18,7 +18,6 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.TemplateSavingChecker;
import com.fr.design.mainframe.manager.search.TemplateTreeSearchManager;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.TemplateUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.design.worker.WorkerManager;
@ -41,11 +40,11 @@ import javax.swing.JComponent;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.MenuElement;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.plaf.basic.BasicMenuItemUI;
import java.awt.AWTEvent;
import java.awt.AlphaComposite;
@ -69,6 +68,8 @@ import java.awt.geom.Line2D;
import java.awt.geom.Path2D;
import java.awt.geom.RoundRectangle2D;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.fr.design.dialog.FineJOptionPane.showConfirmDialog;
import static javax.swing.JOptionPane.OK_CANCEL_OPTION;
@ -85,12 +86,12 @@ import static javax.swing.JOptionPane.WARNING_MESSAGE;
**/
public class MultiTemplateTabPane extends JComponent {
private static Icon LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_normal.png");
private static Icon MOUSE_OVER_LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_pressed.png");
private static Icon MOUSE_PRESS_LIST_DOWN = BaseUtils.readIcon("/com/fr/design/images/buttonicon/list_pressed.png");
private static Icon CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png");
private static Icon MOUSE_OVER_CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/mouseoverclose icon.png");
private static Icon MOUSE_PRESS_CLOSE = BaseUtils.readIcon("/com/fr/design/images/buttonicon/pressclose icon.png");
private static Icon LIST_DOWN = IconUtils.readIcon("/com/fr/design/standard/list/list");
private static Icon MOUSE_OVER_LIST_DOWN = IconUtils.readIcon("/com/fr/design/standard/list/list_pressed.svg");
private static Icon MOUSE_PRESS_LIST_DOWN = IconUtils.readIcon("/com/fr/design/standard/list/list_pressed.svg");
private static Icon CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close");
private static Icon MOUSE_OVER_CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close_mouseover.svg");
private static Icon MOUSE_PRESS_CLOSE = IconUtils.readIcon("/com/fr/design/standard/close/close_press.svg");
private static final Icon WHITE_SAVING_CLOSE_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/file/white_saving_close.gif"));
private static final Icon GREY_SAVING_CLOSE_ICON = new ImageIcon(IOUtils.readImage("/com/fr/design/images/file/grey_saving_close.gif"));
private static final String ELLIPSIS = "...";
@ -212,6 +213,35 @@ public class MultiTemplateTabPane extends JComponent {
});
}
/**
* 模板可以关闭的条件
*/
class CloseCondition {
private CloseOption closeOption;
public CloseCondition(CloseOption closeOption) {
this.closeOption = closeOption;
}
/**
* 判断模板是否可以关闭两个条件1是否满足CloseOption里面的条件在左侧在右侧等2是否和当前正在编辑模板属于同一种模板tab操作类型
* @param closeJTemplate
* @param tplIndex
* @param i
* @return
*/
public boolean shouldClose(JTemplate closeJTemplate, int tplIndex, int i) {
boolean matchOption = this.closeOption.shouldClose(tplIndex, i);
JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (!JTemplate.isValid(currentTemplate)) {
return matchOption;
}
return matchOption && ComparatorUtils.equals(closeJTemplate.getTemplateTabOperatorType(),
currentTemplate.getTemplateTabOperatorType());
}
}
enum CloseOption {
Left(Toolkit.i18nText("Fine-Design_Close_templates_To_The_Left")) {
@Override
@ -322,29 +352,34 @@ public class MultiTemplateTabPane extends JComponent {
@Override
public void actionPerformed(ActionEvent e) {
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false);
if (saveSomeTempaltePane.showSavePane()) {
//只有关闭所有模板才需要判断当前模板,关闭左侧、右侧、其他都不需要
SaveSomeTemplatePane saveSomeTemplatePane = new SaveSomeTemplatePane(option == CloseOption.All);
CloseCondition closeCondition = new CloseCondition(option);
if (saveSomeTemplatePane.showSavePane(closeCondition, false)) {
JTemplate<?, ?>[] templates = new JTemplate<?, ?>[openedTemplate.size()];
for (int i = 0; i < openedTemplate.size(); i++) {
templates[i] = openedTemplate.get(i);
}
JTemplate<?, ?> currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
closeTemplate(templates, currentTemplate);
closeTemplate(closeCondition, templates, currentTemplate);
if (option == CloseOption.All) {
if (openedTemplate.size() == 0) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
} else if (option == CloseOption.All){
//openedTemplate(0)是JVirtualTemplate时需重新打开
openedTemplate.get(0).activeOldJTemplate();
} else {
DesignerContext.getDesignerFrame().activateJTemplate(currentTemplate);
currentTemplate.activeOldJTemplate();
}
MultiTemplateTabPane.getInstance().repaint();
}
}
private void closeTemplate(JTemplate<?, ?>[] templates, JTemplate<?, ?> currentTemplate) {
private void closeTemplate(CloseCondition closeCondition, JTemplate<?, ?>[] templates, JTemplate<?, ?> currentTemplate) {
for (int i = 0; i < templates.length; i++) {
if (option.shouldClose(tplIndex, i)) {
if (closeCondition.shouldClose(templates[i], tplIndex, i)) {
JTemplate<?, ?> jTemplate = templates[i];
if (jTemplate == currentTemplate) {
currentTemplate = option == CloseOption.All ? null : templates[tplIndex];
@ -377,6 +412,46 @@ public class MultiTemplateTabPane extends JComponent {
return openedTemplate.get(selectedIndex);
}
/**
* 关闭所有指定模板tab操作类型的模板
* @param operatorType
*/
public void closeOtherByOperatorType(String operatorType){
JTemplate<?, ?> currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
SaveSomeTemplatePane saveSomeTempaltePane = new SaveSomeTemplatePane(false);
if (saveSomeTempaltePane.showSavePane()) {
List<JTemplate<?, ?>> openedTemplate = HistoryTemplateListCache.getInstance().getHistoryList();
JTemplate<?, ?>[] templates = new JTemplate<?, ?>[openedTemplate.size()];
for (int i = 0; i < openedTemplate.size(); i++) {
templates[i] = openedTemplate.get(i);
}
closeTemplate(templates, currentEditingTemplate, operatorType);
DesignerContext.getDesignerFrame().activateJTemplate(currentEditingTemplate);
MultiTemplateTabPane.getInstance().repaint();
}
}
/**
* 关闭指定的非当前编辑模板
* @param templates
* @param operatorType
*/
private static void closeTemplate(JTemplate<?, ?>[] templates, JTemplate<?, ?> currentEditingTemplate, String operatorType) {
for (int i = 0; i < templates.length; i++) {
JTemplate<?, ?> jTemplate = templates[i];
boolean needClose = ComparatorUtils.equals(operatorType, jTemplate.getTemplateTabOperatorType())
&& jTemplate != currentEditingTemplate;
if (!needClose) {
continue;
}
MultiTemplateTabPane.getInstance().closeFormat(jTemplate);
HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate);
MultiTemplateTabPane.getInstance().closeAndFreeLock(jTemplate);
}
}
/**
* 关闭掉当前已打开文件列表中指定的文件
@ -477,11 +552,7 @@ public class MultiTemplateTabPane extends JComponent {
private String tempalteShowName(JTemplate<?, ?> template) {
String name = TemplateUtils.createLockeTemplatedName(template, template.getTemplateName());
if (!template.isSaved() && !name.endsWith(" *")) {
name += " *";
}
return name;
return template.getTabShowName(template);
}
/**
@ -499,40 +570,7 @@ public class MultiTemplateTabPane extends JComponent {
private void showListDown() {
UIScrollPopUpMenu menu = new UIScrollPopUpMenu();
menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0));
menu.add(initCloseOther());
JSeparator separator = new JSeparator() {
@Override
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.height = 1;
return d;
}
};
menu.add(new JPanel() {
@Override
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.height = 1;
return d;
}
});
separator.setForeground(UIConstants.LINE_COLOR);
menu.add(separator);
menu.add(new JPanel() {
@Override
public Dimension getPreferredSize() {
Dimension d = super.getPreferredSize();
d.height = 1;
return d;
}
});
UIMenuItem[] items = createListDownTemplate();
for (int i = 0; i < items.length; i++) {
menu.add(items[i]);
}
UIScrollPopUpMenu menu = MultiTemplateTabMenuFactory.getInstance().createMenu();
GUICoreUtils.showPopupMenu(menu, MultiTemplateTabPane.getInstance(), MultiTemplateTabPane.getInstance().getWidth() - menu.getPreferredSize().width, getY() - 1 + getHeight());
}
@ -582,6 +620,9 @@ public class MultiTemplateTabPane extends JComponent {
//从可以开始展示在tab面板上的tab开始画
for (int i = minPaintIndex; i <= maxPaintIndex; i++) {
JTemplate template = openedTemplate.get(i);
if (!showJTemplateTab(template)){
continue;
}
Icon icon = template.getIcon();
String name = tempalteShowName(template);
//如果tab名字的长度大于最大能显示的英文字符长度,则进行省略号处理
@ -716,13 +757,67 @@ public class MultiTemplateTabPane extends JComponent {
minPaintIndex = 0;
maxPaintIndex = openedTemplate.size() - 1;
}
//需要根据每个tab的宽度重新check下实际的maxPaintIndex和minPaintIndex
checkActualPaintIndex();
}
/**
* 先计算出需要补充的tab个数
* @return
*/
private int calTabCountComplemented(){
int a = 0;
for (int i = minPaintIndex; i <= maxPaintIndex; i++) {
JTemplate template = openedTemplate.get(i);
if (!showJTemplateTab(template)) {
a++;
}
}
return a;
}
/**
* 由于可能存在宽度为0的tab所以这边需要重新check下先往后补再往前补
*/
private void checkActualPaintIndex(){
int tabCount = calTabCountComplemented();
if (tabCount == 0){
return;
}
if (maxPaintIndex < openedTemplate.size() - 1) {
for (int i = maxPaintIndex + 1; i < openedTemplate.size(); i++) {
JTemplate template = openedTemplate.get(i);
if (showJTemplateTab(template)) {
tabCount--;
}
maxPaintIndex++;
if (tabCount == 0){
return;
}
}
}
if (minPaintIndex > 0){
for (int i = minPaintIndex - 1; i >= 0; i--) {
JTemplate template = openedTemplate.get(i);
if (showJTemplateTab(template)) {
tabCount--;
}
minPaintIndex--;
if (tabCount == 0){
return;
}
}
}
}
//个数小于最多能容纳的个数的情况下,看看宽度每个要画多少
private void calculateRealAverageWidth(double maxwidth, int templateNum) {
JTemplate jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
List<JTemplate<?, ?>> showTemplates = getOpenedJTemplatesByOperator(jTemplate.getTemplateTabOperatorType());
int num = openedTemplate.size() > templateNum ? templateNum : openedTemplate.size();
int num = Math.min(showTemplates.size(), templateNum);
realWidth = (int) (maxwidth / (num));
if (realWidth > MAXWIDTH) {
realWidth = MAXWIDTH;
@ -931,7 +1026,7 @@ public class MultiTemplateTabPane extends JComponent {
activePrevTemplateAfterClose();
}
private void closeAndFreeLock(@Nonnull JTemplate<?, ?> template) {
public void closeAndFreeLock(@Nonnull JTemplate<?, ?> template) {
FILE file = template.getEditingFILE();
// 只有是环境内的文件,才执行释放锁
if (file != null && file.isEnvFile()) {
@ -985,9 +1080,12 @@ public class MultiTemplateTabPane extends JComponent {
// selectIndex 没有变化,但是对应的模板已经变成了前一张模板
if (closeIconIndex == selectedIndex || isCloseCurrent) {
// 如果当前关闭的模板在最右侧,那么预览上一个,防止数组越界
// 关闭的模板是当前选中的模板时,需要重新计算下一个待展示的模板的index
if (selectedIndex >= maxPaintIndex) {
// selectIndex 不会 <0 因为如果关闭的是打开的最后一个模板,那么关闭之后 openedTemplate.isEmpty() = true
selectedIndex--;
selectedIndex = calNextShowJTemplateIndex(selectedIndex - 1);
} else {
selectedIndex = calNextShowJTemplateIndex(selectedIndex);
}
isCloseCurrent = false;
}
@ -1004,6 +1102,26 @@ public class MultiTemplateTabPane extends JComponent {
}
}
/**
* 计算下一个可以展示的模板index
* @param currentIndex
* @return
*/
public int calNextShowJTemplateIndex(int currentIndex) {
//先看是否有可以展示的模板
for (int i = currentIndex; i >= 0; i--) {
if (showJTemplateTab(openedTemplate.get(i))) {
return i;
}
}
for (int i = currentIndex; i >= 0; i--) {
if (!showJTemplateTab(openedTemplate.get(i))) {
return i;
}
}
return -1;
}
private boolean isOverCloseIcon(int evtX) {
boolean isOverCloseIcon = false;
@ -1026,7 +1144,7 @@ public class MultiTemplateTabPane extends JComponent {
private int getTemplateIndex(int evtX) {
int textX = 0;
for (int i = minPaintIndex; i <= maxPaintIndex; i++) {
int textWidth = realWidth;
int textWidth = showJTemplateTab(openedTemplate.get(i)) ? realWidth : 0;
if (evtX >= textX && evtX < textX + textWidth) {
return i;
}
@ -1088,6 +1206,7 @@ public class MultiTemplateTabPane extends JComponent {
private class MultiTemplateTabMouseListener implements MouseListener {
private boolean oldLightWeightPopupEnabled;
/**
* 鼠标进入
@ -1096,7 +1215,8 @@ public class MultiTemplateTabPane extends JComponent {
*/
@Override
public void mouseEntered(MouseEvent e) {
// do nothing
this.oldLightWeightPopupEnabled = ToolTipManager.sharedInstance().isLightWeightPopupEnabled();
ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
}
/**
@ -1106,6 +1226,9 @@ public class MultiTemplateTabPane extends JComponent {
*/
@Override
public void mouseExited(MouseEvent e) {
ToolTipManager.sharedInstance().setEnabled(false);
ToolTipManager.sharedInstance().setEnabled(true);
ToolTipManager.sharedInstance().setLightWeightPopupEnabled(this.oldLightWeightPopupEnabled);
listDownMode = LIST_DOWN;
closeIconIndex = -1;
mouseOveredIndex = -1;
@ -1171,6 +1294,10 @@ public class MultiTemplateTabPane extends JComponent {
return;
}
}
//参考CloseCurrentTemplateAction,在closeFormat与closeSpecifiedTemplate之前要先设定isCloseCurrent,这样关闭之后才会自动切换tab
if (checkCurrentClose(template)) {
setIsCloseCurrent(true);
}
closeFormat(template);
closeSpecifiedTemplate(template);
DesignerContext.getDesignerFrame().getContentFrame().repaint();
@ -1179,29 +1306,49 @@ public class MultiTemplateTabPane extends JComponent {
//没有点击关闭和ListDown按钮,则切换到点击的模板处
closeIconIndex = -1;
clodeMode = CLOSE;
int tempSelectedIndex = selectedIndex;
if (selectedIndex != getTemplateIndex(evtX) && getTemplateIndex(evtX) != -1) {
openedTemplate.get(selectedIndex).stopEditing();
selectedIndex = getTemplateIndex(evtX);
//如果在权限编辑情况下,不允许切换到表单类型的工作簿
if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported")
+ "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE);
MultiTemplateTabPane.this.repaint();
return;
}
JTemplate evtXTemplate = openedTemplate.get(getTemplateIndex(evtX));
evtXTemplate.activeNewJTemplate();
}
switchJTemplate(getTemplateIndex(evtX));
isShowList = false;
}
MultiTemplateTabPane.this.repaint();
}
}
/**
* 切换到指定模板
* @param jTemplate
*/
public void switchJTemplate(JTemplate jTemplate) {
int switchIndex = this.openedTemplate.indexOf(jTemplate);
if (switchIndex >= 0) {
switchJTemplate(switchIndex);
}
}
/**
* 切换到指定index
* @param switchIndex
*/
private void switchJTemplate(int switchIndex){
int tempSelectedIndex = selectedIndex;
if (selectedIndex != switchIndex && switchIndex != -1) {
openedTemplate.get(selectedIndex).stopEditing();
selectedIndex = switchIndex;
//如果在权限编辑情况下,不允许切换到表单类型的工作簿
if (DesignerMode.isAuthorityEditing() && !openedTemplate.get(selectedIndex).isJWorkBook()) {
DesignerContext.getDesignerFrame().addAndActivateJTemplate(openedTemplate.get(tempSelectedIndex));
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Form_Authority_Edited_Cannot_Be_Supported")
+ "!", Toolkit.i18nText("Fine-Design_Basic_Alert"), JOptionPane.WARNING_MESSAGE);
MultiTemplateTabPane.this.repaint();
return;
}
JTemplate evtXTemplate = openedTemplate.get(switchIndex);
evtXTemplate.activeNewJTemplate();
}
}
private boolean checkCurrentClose(JTemplate template) {
JTemplate currentTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return JTemplate.isValid(currentTemplate) && ComparatorUtils.equals(template.getPath(), currentTemplate.getPath());
}
private class MultiTemplateTabMouseMotionListener implements MouseMotionListener {
@ -1241,5 +1388,34 @@ public class MultiTemplateTabPane extends JComponent {
}
}
/**
* 判断是否显示在tab栏上
* @param jTemplate
* @return
*/
private boolean showJTemplateTab(JTemplate jTemplate){
JTemplate current = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return ComparatorUtils.equals(current.getTemplateTabOperatorType(), jTemplate.getTemplateTabOperatorType());
}
/**
* 获取tab操作类型的模板
* @param operator
* @return
*/
public List<JTemplate<?, ?>> getOpenedJTemplatesByOperator(String operator) {
return openedTemplate.stream().filter((jTemplate) -> ComparatorUtils.equals(jTemplate.getTemplateTabOperatorType(), operator))
.collect(Collectors.toList());
}
/**
* 根据tab操作类型进行分类
* @return
*/
public Map<String, List<JTemplate<?, ?>>> getOpenedJTemplatesByCategory() {
return openedTemplate.stream()
.collect(Collectors.groupingBy(JTemplate::getTemplateTabOperatorType));
}
}

10
designer-base/src/main/java/com/fr/design/file/NewTemplatePane.java

@ -81,11 +81,19 @@ public abstract class NewTemplatePane extends JComponent implements MouseListene
}
if (isOverNewIcon(evtX) && newWorkBookIconMode != GRAY_NEW_CPT) {
newWorkBookIconMode = getMousePressNew();
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
createNewTemplate();
}
this.repaint();
}
/**
* 新建模板
*/
protected void createNewTemplate() {
DesignerContext.getDesignerFrame().addAndActivateJTemplate();
}
/**
*鼠标松开
* @param e 事件

60
designer-base/src/main/java/com/fr/design/file/SaveSomeTemplatePane.java

@ -17,6 +17,7 @@ import com.fr.design.mainframe.JTemplate;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
@ -47,6 +48,7 @@ public class SaveSomeTemplatePane extends BasicPane {
/**
* 支持自定义设置 dialog的父窗口
*
* @param isNeedTojudgeCurrent
* @param parent
*/
@ -79,11 +81,14 @@ public class SaveSomeTemplatePane extends BasicPane {
this.isJudgeCurrentEditingTemplate = isNeedTojudgeCurrent;
}
private void initTemplatesChoosePane() {
private void initTemplatesChoosePane(boolean judgeJTemplateMustSave) {
templatesChoosePane.setBorder(BorderFactory.createTitledBorder(""));
for (int i = 0; i < unSavedTemplate.size(); i++) {
templateCheckBoxes[i] = new UICheckBox(unSavedTemplate.get(i).getEditingFILE().getName());
templateCheckBoxes[i].setSelected(true);
boolean needSave = judgeJTemplateMustSave && unSavedTemplate.get(i).needSaveBeforeSwitchEnv();
templateCheckBoxes[i].setEnabled(!needSave);
}
final UIList templatesList = new UIList(templateCheckBoxes);
@ -103,7 +108,10 @@ public class SaveSomeTemplatePane extends BasicPane {
boolean isSelected = chooseAllCheckBox.isSelected();
for (int i = 0; i < templatesList.getModel().getSize(); i++) {
UICheckBox checkBox = (UICheckBox) templatesList.getModel().getElementAt(i);
checkBox.setSelected(isSelected);
boolean mustSaveBeforeSwitchEnv = judgeJTemplateMustSave && unSavedTemplate.get(i).needSaveBeforeSwitchEnv();
checkBox.setSelected(mustSaveBeforeSwitchEnv || isSelected);
templateCheckBoxes[i].setEnabled(!mustSaveBeforeSwitchEnv);
}
templatesList.repaint();
}
@ -116,8 +124,10 @@ public class SaveSomeTemplatePane extends BasicPane {
if (index < 0) {
return;
}
boolean mustSaveBeforeSwitchEnv = judgeJTemplateMustSave
&& unSavedTemplate.get(index).needSaveBeforeSwitchEnv();
UICheckBox checkBox = (UICheckBox) templatesList.getModel().getElementAt(index);
checkBox.setSelected(!checkBox.isSelected());
checkBox.setSelected(mustSaveBeforeSwitchEnv ||!checkBox.isSelected());
//根据templateCheckBoxes中的选择情况来更新全选框的状态
int selectedCount = calculateSelectedNum();
@ -139,7 +149,7 @@ public class SaveSomeTemplatePane extends BasicPane {
/**
* 获取templateCheckBoxes中状态为选中状态的CheckBox数量
* */
*/
private int calculateSelectedNum() {
int count = 0;
for (UICheckBox checkBox : templateCheckBoxes) {
@ -152,7 +162,28 @@ public class SaveSomeTemplatePane extends BasicPane {
public boolean showSavePane() {
populate();
return showSavePane(false);
}
/**
* 显示保存模板提醒面板
*
* @param judgeJTemplateMustSave 模板是否必须保存
* @return
*/
public boolean showSavePane(boolean judgeJTemplateMustSave) {
return showSavePane(null, judgeJTemplateMustSave);
}
/**
* 显示保存模板提醒面板
*
* @param option 具体关闭操作
* @param judgeJTemplateMustSave 模板是否必须保存
* @return
*/
public boolean showSavePane(@Nullable MultiTemplateTabPane.CloseCondition option, boolean judgeJTemplateMustSave) {
initAndPopulate(option, judgeJTemplateMustSave);
//如果有未保存的文件 ,则跳出保存对话框,选择要存储的项目
if (!unSavedTemplate.isEmpty()) {
dialog.setVisible(true);
@ -162,19 +193,26 @@ public class SaveSomeTemplatePane extends BasicPane {
return isAllSaved;
}
public void populate() {
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
protected java.util.List<JTemplate<?, ?>> getOpenedTemplatesToProcess(){
return HistoryTemplateListPane.getInstance().getHistoryList();
}
private void initAndPopulate(@Nullable MultiTemplateTabPane.CloseCondition option, boolean judgeJTemplateMustSave) {
java.util.List<JTemplate<?, ?>> opendedTemplate = getOpenedTemplatesToProcess();
JTemplate<?, ?> currentTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
int currentIndex = opendedTemplate.indexOf(currentTemplate);
for (int i = 0; i < opendedTemplate.size(); i++) {
if (isneedToAdd(opendedTemplate.get(i), currentTemplate)) {
//满足关闭条件的才继续判断文件是否发生了改动
boolean needClose = option == null || option.shouldClose(opendedTemplate.get(i), currentIndex, i);
if (needClose && isneedToAdd(opendedTemplate.get(i), currentTemplate)) {
unSavedTemplate.add(opendedTemplate.get(i));
}
}
templateCheckBoxes = new UICheckBox[unSavedTemplate.size()];
initTemplatesChoosePane();
initTemplatesChoosePane(judgeJTemplateMustSave);
}
private boolean isneedToAdd(JTemplate<?, ?> template, JTemplate<?, ?> currentTemplate) {
protected boolean isneedToAdd(JTemplate<?, ?> template, JTemplate<?, ?> currentTemplate) {
//所有模板都判断是不是保存
if (isJudgeCurrentEditingTemplate) {
return !template.isALLSaved();
@ -194,7 +232,7 @@ public class SaveSomeTemplatePane extends BasicPane {
specifiedTemplate.stopEditing();
return specifiedTemplate.saveTemplate();
}
FineLoggerFactory.getLogger().info( com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
FineLoggerFactory.getLogger().info(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Template_Already_Saved", specifiedTemplate.getEditingFILE().getName()));
return true;
}

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

@ -1,5 +1,6 @@
package com.fr.design.gui;
import com.fr.base.svg.IconUtils;
import com.fr.design.gui.borders.UIFrameBorder;
import com.fr.design.gui.borders.UIInternalFrameBorder;
import com.fr.design.gui.borders.UITableHeaderBorder;
@ -163,7 +164,7 @@ public class UILookAndFeel extends MetalLookAndFeel {
table.put("Tree.leafIcon", loadIcon("TreeLeafIcon.png", this));
table.put("FileView.directoryIcon", loadIcon("DirectoryIcon.png", this));
table.put("FileView.computerIcon", loadIcon("ComputerIcon.png", this));
table.put("FileView.fileIcon", loadIcon("FileIcon.png", this));
table.put("FileView.fileIcon", IconUtils.readIcon("/com/fr/design/images/lookandfeel/FileIcon.svg"));
table.put("FileView.floppyDriveIcon", loadIcon("FloppyIcon.png", this));
table.put("FileView.hardDriveIcon", loadIcon("HarddiskIcon.png", this));
table.put("FileChooser.detailsViewIcon", loadIcon("FileDetailsIcon.png", this));

7
designer-base/src/main/java/com/fr/design/gui/controlpane/AbstractNameableCreator.java

@ -1,6 +1,7 @@
package com.fr.design.gui.controlpane;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.beans.BasicBeanPane;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject;
@ -25,14 +26,14 @@ public abstract class AbstractNameableCreator implements NameableCreator {
public AbstractNameableCreator(String menuName, String iconPath, Class clazz) {
this.menuName = menuName;
this.menuIcon = BaseUtils.readIcon(iconPath);
this.menuIcon = IconUtils.readIcon(iconPath);
this.clazzOfObject = clazz;
this.clazzOfInitCase = clazz;
}
public AbstractNameableCreator(String menuName, String iconPath, Class clazz, Class<? extends BasicBeanPane> clazzOfEditor) {
this.menuName = menuName;
this.menuIcon = BaseUtils.readIcon(iconPath);
this.menuIcon = IconUtils.readIcon(iconPath);
this.clazzOfObject = clazz;
this.clazzOfEditor = clazzOfEditor;
this.clazzOfInitCase = clazz;
@ -40,7 +41,7 @@ public abstract class AbstractNameableCreator implements NameableCreator {
public AbstractNameableCreator(String menuName, String iconPath, Class clazz, Class clazz4Init, Class<? extends BasicBeanPane> clazzOfEditor) {
this.menuName = menuName;
this.menuIcon = BaseUtils.readIcon(iconPath);
this.menuIcon = IconUtils.readIcon(iconPath);
this.clazzOfObject = clazz;
this.clazzOfEditor = clazzOfEditor;
this.clazzOfInitCase = clazz;

50
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -17,16 +17,19 @@ import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -343,21 +346,46 @@ public abstract class JListControlPane extends JControlPane implements ListContr
}
protected class NameableListCellRenderer extends
DefaultListCellRenderer {
JPanel implements ListCellRenderer<Object> {
private final JLabel textLabel;
private final JLabel iconLabel;
/**
* JList默认单元格渲染器的选中背景色
*/
private final Color selectedBgColor = new Color(65, 155, 249);
protected NameableListCellRenderer() {
setLayout(new BorderLayout());
this.textLabel = new JLabel();
this.iconLabel = new JLabel();
add(this.textLabel, BorderLayout.CENTER);
add(this.iconLabel, BorderLayout.WEST);
this.iconLabel.setBackground(Color.WHITE);
//iconLabel和textLabel的背景颜色不会被JList背景颜色覆盖,开发者自定义
this.textLabel.setOpaque(true);
this.iconLabel.setOpaque(true);
}
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected,
cellHasFocus);
if (value instanceof ListModelElement) {
ListModelElement element = ((ListModelElement) value);
Nameable nameable = element.wrapper;
this.setText(nameable.getName());
this.textLabel.setText(nameable.getName());
boolean iconSet = false;
if(isSelected) {
this.textLabel.setBackground(selectedBgColor);
this.textLabel.setForeground(Color.WHITE);
} else {
this.textLabel.setBackground(Color.WHITE);
this.textLabel.setForeground(Color.BLACK);
}
for (NameableCreator creator : JListControlPane.this.creators()) {
if (creator.menuIcon() != null && creator.acceptObject2Populate(nameable) != null) {
this.setIcon(creator.menuIcon());
this.iconLabel.setIcon(creator.menuIcon());
this.setToolTipText(creator.createTooltip());
iconSet = true;
break;
@ -369,8 +397,16 @@ public abstract class JListControlPane extends JControlPane implements ListContr
}
return this;
}
}
/**
* 改造后兼容子类NoIconNameableListCellRenderer使用,添加此setIcon函数
*
* @param icon 图标,可为null
*/
public void setIcon(Icon icon) {
this.iconLabel.setIcon(icon);
}
}
@Override
public BasicBeanPane createPaneByCreators(NameableCreator creator) {
return Reflect.on(creator.getUpdatePane()).create().get();

31
designer-base/src/main/java/com/fr/design/gui/controlpane/UIListGroupControlPane.java

@ -28,14 +28,7 @@ import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.AlphaComposite;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.lang.reflect.Constructor;
@ -146,7 +139,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
}
this.checkButtonEnabled();
refreshEventListWrapperPane();
this.checkGroupPaneSize();
this.updateGroupPaneSize(contentPane);
isPopulating = false;
}
@ -214,7 +207,7 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
nameEdList.addModNameActionListener(new ModNameActionListener() {
@Override
public void nameModed(int index, String oldName, String newName) {
checkGroupPaneSize();
updateGroupPaneSize(contentPane);
saveSettings();
}
});
@ -304,24 +297,30 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
public void onAddItem(NameableCreator creator) {
updateSelectedNameList(creator);
getCommonHandlers().onAddItem(creator);
checkGroupPaneSize();
updateGroupPaneSize(contentPane);
}
@Override
public void onRemoveItem() {
getCommonHandlers().onRemoveItem();
refreshEventListWrapperPane();
checkGroupPaneSize();
updateGroupPaneSize(contentPane);
}
@Override
public void onCopyItem() {
getCommonHandlers().onCopyItem();
checkGroupPaneSize();
updateGroupPaneSize(contentPane);
}
private void checkGroupPaneSize() {
/**
* 根据父面板更新对应的面板宽度
* 如果小于父面板的宽度就填充到与父面板宽度一致
*
* @param parentPane 父面板
*/
private void updateGroupPaneSize(JPanel parentPane) {
int width = 180;
Iterator<Map.Entry<String, ListWrapperPane>> iterator = nameEdListMap.entrySet().iterator();
while (iterator.hasNext()) {
@ -331,7 +330,9 @@ public abstract class UIListGroupControlPane extends UIControlPane implements Li
width = Math.max(width, calculateUIListMaxCellWidth(uiList.getModel(), uiList.getFontMetrics(uiList.getFont())));
}
iterator = nameEdListMap.entrySet().iterator();
width += 30;
//contentPane是外层的Panel,如果不进行判断的话宽度就可能会小于contentPanel,右侧会有空隙
//所以需要判断一下,如果外层比较宽就取外层的宽度,防止空隙出现
width = Math.max(width + 30, parentPane == null ? 0 : parentPane.getWidth());
while (iterator.hasNext()) {
Map.Entry<String, ListWrapperPane> entry = iterator.next();
ListWrapperPane wrapperPane = entry.getValue();

18
designer-base/src/main/java/com/fr/design/gui/icontainer/UIEastResizableContainer.java

@ -5,10 +5,21 @@ import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.SvgDrawUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*;
import java.awt.*;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.LayoutManager;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
@ -313,7 +324,6 @@ public class UIEastResizableContainer extends JPanel {
@Override
public void paint(Graphics g) {
Image button;
if (containerWidth == leftPaneWidth) {
if (model == UIConstants.MODEL_NORMAL) {
button = UIConstants.DRAG_LEFT_NORMAL;
@ -327,7 +337,7 @@ public class UIEastResizableContainer extends JPanel {
button = UIConstants.DRAG_RIGHT_PRESS;
}
}
g.drawImage(button, 18, 7, 5, 10, null);
SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, 10, 7, null));
}
}
}

2
designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java

@ -282,7 +282,7 @@ public class UIModeControlContainer extends JLayeredPane {
setLayout(new FlowLayout(FlowLayout.CENTER, 10, -3));
setBackground(UIConstants.NORMAL_BACKGROUND);
add(new UILabel("<html><font size='5' face='Microsoft YaHei' color='#999999999'><B>" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel") + "</B></font></html>"));
UIButton viewButton = new UIButton(UIConstants.VIEW_NORMAL_ICON, UIConstants.VIEW_PRESSED_ICON, UIConstants.VIEW_PRESSED_ICON) {
UIButton viewButton = new UIButton(UIConstants.VIEW_NORMAL_ICON, UIConstants.VIEW_NORMAL_ICON, UIConstants.VIEW_NORMAL_ICON) {
@Override
public Dimension getPreferredSize() {
return new Dimension(32, 32);

29
designer-base/src/main/java/com/fr/design/gui/icontainer/UIResizableContainer.java

@ -3,11 +3,22 @@ package com.fr.design.gui.icontainer;
import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.stable.Constants;
import com.fr.design.utils.SvgDrawUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.Constants;
import javax.swing.*;
import java.awt.*;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.LayoutManager;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
@ -406,13 +417,13 @@ public class UIResizableContainer extends JPanel {
@Override
public void paint(Graphics g) {
Image upButton = (upModel == UIConstants.MODEL_NORMAL ? UIConstants.DRAG_UP_NORMAL : UIConstants.DRAG_UP_PRESS);
Image downButton = (downModel == UIConstants.MODEL_NORMAL ? UIConstants.DRAG_DOWN_NORMAL : UIConstants.DRAG_DOWN_PRESS);
g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, getWidth(), getHeight(), null);
g.drawImage(UIConstants.DRAG_LINE, (getWidth() - toolPaneHeight) / 2, 3, toolPaneHeight, 5, null);
g.drawImage(upButton, ARROW_MARGIN, 3, toolPaneHeight, 5, null);
g.drawImage(downButton, getWidth() - toolPaneHeight - ARROW_MARGIN, 3, toolPaneHeight, 5, null);
SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, UIConstants.DRAG_LINE, (getWidth() - toolPaneHeight) / 2, 3, null));
SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, upButton, ARROW_MARGIN, 0, null));
SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, downButton, (getWidth() - toolPaneHeight - ARROW_MARGIN), 0, null));
}
}
@ -509,7 +520,7 @@ public class UIResizableContainer extends JPanel {
button = UIConstants.DRAG_LEFT_PRESS;
}
}
g.drawImage(button, 3, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, -6, ARROW_MARGIN_VERTICAL, VerticalToolPane.this));
} else {
g.drawImage(UIConstants.DRAG_BAR_LIGHT, 0, 0, toolPaneHeight, getHeight(), null);
if (containerWidth == toolPaneHeight) {
@ -525,7 +536,7 @@ public class UIResizableContainer extends JPanel {
button = UIConstants.DRAG_RIGHT_PRESS;
}
}
g.drawImage(button, 2, ARROW_MARGIN_VERTICAL, 5, toolPaneHeight, null);
SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, 10, ARROW_MARGIN_VERTICAL, VerticalToolPane.this));
}
if (isLeftRightDragEnabled) {
g.drawImage(UIConstants.DRAG_DOT_VERTICAL, 2, getHeight() / 2, 5, toolPaneHeight, null);

14
designer-base/src/main/java/com/fr/design/gui/ilist/JNameEdList.java

@ -11,15 +11,20 @@ import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.ListModel;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import java.util.ArrayList;
import java.util.Vector;
import java.awt.Component;
import java.awt.Rectangle;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.util.ArrayList;
import java.util.Vector;
public class JNameEdList extends UIList implements CellEditorListener {
private static final int ICON_WIDTH = 20;
/**
* 原值为20,设计器图标由png替换为svg之后JNameEdList的icon大小为16x16
* 重命名是会出现左侧一部分带有背景色的渲染
*/
private static final int ICON_WIDTH = 16;
private boolean editable = true;
// kunsnat: 是否强制ListName是数字 (int型)
@ -175,7 +180,8 @@ public class JNameEdList extends UIList implements CellEditorListener {
}
public void setIllegalIndex(int index) {
setNameAt(NameInspector.ILLEGAL_NAME_HOLDER, index);
//环境如果重名会被命名为请重命名,这个请重命名也会重复,后面加个索引区别一下
setNameAt(NameInspector.ILLEGAL_NAME_HOLDER + index, index);
this.repaint();
}

5
designer-base/src/main/java/com/fr/design/gui/itree/UITreeUI.java

@ -1,6 +1,7 @@
package com.fr.design.gui.itree;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.utils.ThemeUtils;
import javax.swing.*;
@ -27,8 +28,8 @@ public class UITreeUI extends MetalTreeUI {
protected void installDefaults() {
super.installDefaults();
setExpandedIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/minus.png"));
setCollapsedIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/plus.png"));
setExpandedIcon(IconUtils.readIcon("/com/fr/design/standard/fileicon/minus.svg"));
setCollapsedIcon(IconUtils.readIcon("/com/fr/design/standard/fileicon/plus.svg"));
if (tree.getCellRenderer() instanceof DefaultTreeCellRenderer) {
DefaultTreeCellRenderer r = (DefaultTreeCellRenderer) tree.getCellRenderer();
r.setBackgroundNonSelectionColor(ThemeUtils.TEXT_BG_COLOR);

15
designer-base/src/main/java/com/fr/design/gui/itree/filetree/FileTreeIcon.java

@ -1,6 +1,7 @@
package com.fr.design.gui.itree.filetree;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.icon.LocalFileIcon;
import com.fr.design.icon.LockIcon;
@ -24,9 +25,9 @@ public class FileTreeIcon {
public static final Icon BLANK_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/blank.gif");
public static final Icon FOLDER_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/folder.png");
public static final Icon FOLDER_IMAGE_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/folder.svg");
public static final Icon FOLDER_HALF_IMAGE_ICON =
BaseUtils.readIcon("/com/fr/design/images/gui/filetree_folder_half_authority_normal.png");
IconUtils.readIcon("/com/fr/design/standard/fileicon/folder_half_authority.svg");
public static final Icon FILE_IMAGE_ICON = UIManager.getIcon("FileView.fileIcon");
@ -45,14 +46,14 @@ public class FileTreeIcon {
public static final Icon CHT_FILE_IMAGE_ICON = BaseUtils.readIcon("/com/fr/design/images/gui/cht.png");
public static final Icon MODERN_CPT_FILE_IMAGE_ICON =
BaseUtils.readIcon("/com/fr/design/images/gui/modern_style_cpt_file_icon_16x16.png");
IconUtils.readIcon("/com/fr/design/standard/fileicon/cpt_icon.svg");
public static final Icon MODERN_FRM_FILE_IMAGE_ICON =
BaseUtils.readIcon("/com/fr/design/images/gui/modern_style_frm_file_icon_16x16.png");
IconUtils.readIcon("/com/fr/design/standard/fileicon/frm_icon.svg");
public static final Icon MODERN_CHT_FILE_IMAGE_ICON =
BaseUtils.readIcon("/com/fr/design/images/gui/modern_style_cht_file_icon_16x16.png");
IconUtils.readIcon("/com/fr/design/standard/fileicon/cht_icon.svg");
public static final Icon CPTX_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/cptx_file_icon.png");
public static final Icon CPTX_LOCKED_ICON = BaseUtils.readIcon("/com/fr/nx/app/designer/cptx_file_icon_locked.png");
public static final Icon CPTX_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/cptx_icon.svg");
public static final Icon CPTX_LOCKED_ICON = IconUtils.readIcon("/com/fr/design/standard/fileicon/cptx_icon_locked.svg");
public static final LockIcon FOLDER_LOCK_ICON =
new LockIcon(BaseUtils.readImage("/com/fr/design/images/gui/fold.png"));

16
designer-base/src/main/java/com/fr/design/gui/style/TranslucentBorderSpecialPane.java

@ -16,6 +16,7 @@ import com.fr.design.gui.frpane.UIPercentDragPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
@ -26,8 +27,8 @@ import com.fr.design.style.color.NewColorSelectBox;
import com.fr.env.utils.DesignerInteractionHistory;
import com.fr.general.Background;
import com.fr.general.IOUtils;
import com.fr.i18n.UrlI18nManager;
import com.fr.general.act.BorderPacker;
import com.fr.i18n.UrlI18nManager;
import com.fr.stable.Constants;
import com.fr.stable.GraphDrawHelper;
import com.fr.stable.ProjectLibrary;
@ -78,7 +79,18 @@ import java.util.Arrays;
public class TranslucentBorderSpecialPane extends AbstractBorderPackerPane implements UIObserver {
private final int SETTING_LABEL_WIDTH = 60;
private final Style DEFAULT_IMAGE_LAYOUT_STYLE = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_DEFAULT);
private final String TWEAK_NINE_POINT_HELP_URL = "https://help.fanruan.com/finereport/doc-view-4135.html";
/**
* 云中心点九图帮助文档在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Nine_Patch";
/**
* 云中心点九图帮助文档默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Nine_Patch_Default";
private final String TWEAK_NINE_POINT_HELP_URL = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
private UIObserverListener uiObserverListener;

47
designer-base/src/main/java/com/fr/design/i18n/LocaleLinkProvider.java

@ -0,0 +1,47 @@
package com.fr.design.i18n;
import com.fr.general.CloudCenter;
import com.fr.stable.StringUtils;
/**
* 国际化链接获取工具
* 根据配置文件key获取云中心key对应的链接或者默认链接
*
* @author obo
* @since 11.0
* Created on 2023/4/7
*/
public final class LocaleLinkProvider {
private LocaleLinkProvider(){};
/**
* 单一实例
*/
private static final LocaleLinkProvider INSTANCE = new LocaleLinkProvider();
/**
* 返回LocaleLinkProvider的单一实例
*
* @return LocaleLinkProvider单一实例
*/
public static LocaleLinkProvider getInstance(){
return INSTANCE;
}
/**
* 根据配置文件项中的key获取链接
*
* @param propsKey 配置项key
* @param defaultKey 默认链接项key
* @return 对应的生成器
*/
public String getLink(String propsKey, String defaultKey) {
String cloudKey = DesignI18nImpl.getInstance().i18nText(propsKey);
String url = CloudCenter.getInstance().acquireUrlByKind(cloudKey);
if(StringUtils.isEmpty(url)) {
return DesignI18nImpl.getInstance().i18nText(defaultKey);
}
return url;
}
}

8
designer-base/src/main/java/com/fr/design/icon/IconPathConstants.java

@ -15,21 +15,21 @@ public class IconPathConstants {
public static final String ADD_POPMENU_ICON_PATH = "/com/fr/design/images/control/addPopup.png";
public static final String DS_ICON_PATH = "/com/fr/design/images/data/datasource.png";
public static final String DS_ICON_PATH = "/com/fr/design/standard/server_database";
public static final String CLASS_TD_ICON_PATH = "/com/fr/design/images/data/source/classTableData.png";
public static final String EMB_TD_ICON_PATH = "/com/fr/design/images/data/dataTable.png";
public static final String DS_RELATION_TD_ICON_PATH = "/com/fr/design/images/data/multi.png";
public static final String FILE_TD_ICON_PATH = "/com/fr/design/images/data/file.png";
public static final String DS_TREE_TD_ICON_PATH = "/com/fr/design/images/data/tree.png";
public static final String DS_QUERY_ICON_PATH = "/com/fr/design/images/data/database.png";
public static final String DS_QUERY_ICON_PATH = "/com/fr/design/standard/database";
public static final String PREVIEW_ICON_PATH = "/com/fr/design/images/m_file/preview.png";
public static final String TD_EDIT_ICON_PATH = "/com/fr/design/images/control/edit.png";
public static final String TD_EL_SHARE_HELP_ICON_PATH = "/com/fr/design/images/control/help_open.png";
public static final String TD_EL_SHARE_CLOSE_ICON_PATH = "/com/fr/design/images/control/help_close.png";
public static final String TD_REMOVE_ICON_PATH = "/com/fr/design/images/control/remove.png";
public static final String TD_CONNECTION_ICON_PATH = "/com/fr/design/images/m_web/connection.png";
public static final String SP_SHOW_ICON_PATH = "/com/fr/design/images/data/store_procedure.png";
public static final String STD_SHOW_ICON_PATH = "/com/fr/design/images/data/dock/serverdatabase.png";
public static final String SP_SHOW_ICON_PATH = "/com/fr/design/standard/store_procedure";
public static final String STD_SHOW_ICON_PATH = "/com/fr/design/standard/server_database";
public static final String XMLA_ICON_PATH = "/com/fr/design/images/data/cube.png";
public static final String FORBID_ICON_PATH = "/com/fr/web/images/form/forbid.png";
public static final String EDIT_ICON_PATH = "/com/fr/design/images/control/newEdit.png";

41
designer-base/src/main/java/com/fr/design/icon/WarningIcon.java

@ -1,12 +1,15 @@
package com.fr.design.icon;
import com.fr.base.BaseUtils;
import com.fr.base.svg.SVGLoader;
import com.fr.base.svg.SystemScaleUtils;
import com.fr.design.utils.SvgDrawUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.GrayFilter;
import javax.swing.ImageIcon;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.image.ImageObserver;
@ -18,11 +21,12 @@ import java.awt.image.ImageObserver;
* @since 2012-3-28下午10:20:29
*/
public class WarningIcon extends ImageIcon {
protected final static Component component = new Component() {
protected final static Component COMPONENT = new Component() {
};
protected final static MediaTracker tracker = new MediaTracker(component);
private final static Image warnighImage = BaseUtils.readImage("/com/fr/design/images/gui/warning.png");
protected final static MediaTracker TRACKER = new MediaTracker(COMPONENT);
private final static Image WARNING_IMAGE = SVGLoader.load("/com/fr/design/standard/warning.svg");
private static final boolean HI_DPI_SUPPORT = SystemScaleUtils.isJreHiDPIEnabled();
public static final float SYSTEM_SCALE = SystemScaleUtils.sysScale();
private Image mainImage = null;
private ImageObserver imageObserver;
private int width = -1;
@ -38,12 +42,15 @@ public class WarningIcon extends ImageIcon {
@Override
public synchronized void paintIcon(Component c, Graphics g, int x, int y) {
//裁剪绘制svg的位置,以免影响到图标右侧的文字
Graphics2D graphics = (Graphics2D) g.create(x, y, WARNING_IMAGE.getWidth(null), WARNING_IMAGE.getHeight(null));
if (mainImage != null) {
g.drawImage(mainImage, x, y, c);
SvgDrawUtils.doDrawSVG(graphics, () -> SvgDrawUtils.drawImage(graphics, mainImage, x, y, null));
}
if (warnighImage != null) {
g.drawImage(warnighImage, x, y, c);
if (WARNING_IMAGE != null) {
SvgDrawUtils.doDrawSVG(graphics, () -> SvgDrawUtils.drawImage(graphics, WARNING_IMAGE, x, y, null));
}
graphics.dispose();
}
/**
@ -53,17 +60,17 @@ public class WarningIcon extends ImageIcon {
* the image
*/
protected void loadImage(Image image) {
synchronized (tracker) {
tracker.addImage(image, 0);
synchronized (TRACKER) {
TRACKER.addImage(image, 0);
try {
tracker.waitForID(0, 0);
TRACKER.waitForID(0, 0);
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
Thread.currentThread().interrupt();
}
tracker.statusID(0, false);
tracker.removeImage(image, 0);
TRACKER.statusID(0, false);
TRACKER.removeImage(image, 0);
width = image.getWidth(imageObserver);
height = image.getHeight(imageObserver);
@ -91,7 +98,8 @@ public class WarningIcon extends ImageIcon {
* @return the width in pixels of this icon
*/
public int getIconWidth() {
return width;
//如果环境支持高清化,drawImage可能会缩放绘制的图像比例,需要保证svg正常显示的同时调整绘制范围
return HI_DPI_SUPPORT ? (int) (width / SYSTEM_SCALE) : width;
}
/**
@ -100,10 +108,11 @@ public class WarningIcon extends ImageIcon {
* @return the height in pixels of this icon
*/
public int getIconHeight() {
return height;
//如果环境支持高清化,drawImage可能会缩放绘制的图像比例,需要保证svg正常显示的同时调整绘制范围
return HI_DPI_SUPPORT ? (int) (height / SYSTEM_SCALE) : height;
}
{
loadImage(warnighImage);
loadImage(WARNING_IMAGE);
}
}

110
designer-base/src/main/java/com/fr/design/javascript/JSContentWithDescriptionPane.java

@ -14,11 +14,11 @@ import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.design.gui.itextfield.PlaceholderTextField;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.javascript.jsapi.JSAPITreeHelper;
import com.fr.design.javascript.jsapi.JSAPIUserObject;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.http.HttpToolbox;
import com.fr.json.JSONArray;
@ -26,6 +26,26 @@ import com.fr.json.JSONException;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.SwingWorker;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
@ -50,24 +70,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JComponent;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.util.concurrent.ExecutionException;
public class JSContentWithDescriptionPane extends JSContentPane implements KeyListener {
@ -117,6 +120,15 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private static final String RELOAD_CARD = "reloadCard";
private static final String DOC_LIST_CARD = "docListCard";
/**
* 云中心Js高级编辑器帮助链接前缀在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Js_Editor";
/**
* 云中心Js高级编辑器帮助链接前缀在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Js_Editor_Default";
public JSContentWithDescriptionPane(String[] args) {
this.setLayout(new BorderLayout());
//===============================
@ -352,27 +364,51 @@ public class JSContentWithDescriptionPane extends JSContentPane implements KeyLi
private void doHelpDocumentSearch() {
Object value = interfaceNameList.getSelectedValue();
if (value != null) {
String url = CloudCenter.getInstance().acquireUrlByKind("af.doc_search", DOCUMENT_SEARCH_URL) + value.toString();
try {
String result = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.optJSONArray("list");
if (jsonArray != null) {
DefaultListModel helpDOCModel = (DefaultListModel) helpDOCList.getModel();
helpDOCModel.clear();
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject resultJSONObject = jsonArray.optJSONObject(i);
String docURL = resultJSONObject.optString("url");
String name = resultJSONObject.optString("title").trim();
HelpDocument helpDocument = new HelpDocument(docURL, name);
helpDOCModel.addElement(helpDocument);
new SwingWorker<List<HelpDocument>, Void>() {
@Override
protected List<HelpDocument> doInBackground() {
List<HelpDocument> helpDocuments = new ArrayList<>();
updateHelpDocuments(value, helpDocuments);
return helpDocuments;
}
@Override
protected void done() {
try {
List<HelpDocument> helpDocuments = get();
DefaultListModel helpDOCModel = (DefaultListModel) helpDOCList.getModel();
helpDOCModel.clear();
for (HelpDocument helpDocument : helpDocuments) {
helpDOCModel.addElement(helpDocument);
}
} catch (InterruptedException | ExecutionException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
} catch (JSONException e) {
FineLoggerFactory.getLogger().debug(e.getMessage(), e);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}.execute();
}
}
private void updateHelpDocuments(Object value, List<HelpDocument> helpDocuments) {
String url = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT) + value.toString();
try {
String result = HttpToolbox.get(url);
JSONObject jsonObject = new JSONObject(result);
JSONArray jsonArray = jsonObject.optJSONArray("list");
if (jsonArray != null) {
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject resultJSONObject = jsonArray.optJSONObject(i);
String docURL = resultJSONObject.optString("url");
String name = resultJSONObject.optString("title").trim();
HelpDocument helpDocument = new HelpDocument(docURL, name);
helpDocuments.add(helpDocument);
}
}
} catch (JSONException e) {
FineLoggerFactory.getLogger().debug(e.getMessage(), e);
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}

13
designer-base/src/main/java/com/fr/design/javascript/JavaScriptActionPane.java

@ -48,8 +48,7 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
contentDBManiPane.add(createDBManipulationPane());
paneList.add(new Commit2DBJavaScriptPane(this, contentDBManiPane));
paneList.add(initEmaiPane());
boolean workbook = DesignerContext.getDesignerFrame().getSelectedJTemplate().isJWorkBook();
if (workbook) {
if (isWorkBookValid()) {
paneList.add(new ExportJavaScriptPane());
}
paneList.add(new MobilePopupPane());
@ -66,6 +65,16 @@ public abstract class JavaScriptActionPane extends UIComboBoxPane<JavaScript> {
return paneList;
}
/**
* 选中的JTemplate是否有效并且是否是工作簿
*
* @return 选中的JTemplate有效并且是工作簿则返回true
*/
private boolean isWorkBookValid() {
return DesignerContext.getDesignerFrame().getSelectedJTemplate() != null
&& DesignerContext.getDesignerFrame().getSelectedJTemplate().isJWorkBook();
}
protected EmailPane initEmaiPane() {
return new EmailPane();
}

32
designer-base/src/main/java/com/fr/design/locale/impl/BbsRegisterMark.java

@ -1,13 +1,8 @@
package com.fr.design.locale.impl;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @author hades
* @version 10.0
@ -15,24 +10,19 @@ import java.util.Map;
*/
public class BbsRegisterMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_REGISTER_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "https://id.fanruan.com/register/register.php?clueSource=activityfr");
private static final String BBS_REGISTER_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.register", "https://id.fanruan.com/register/register.php?clueSource=activityfr");
private static final String BBS_REGISTER_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php");
private static final String BBS_REGISTER_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php");
private static final String BBS_REGISTER_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.register.en_US", "https://id.fanruan.com/en/register/register.php");
/**
* 云中心新账户中心链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_New_Account_Center";
public BbsRegisterMark() {
map.put(Locale.CHINA, BBS_REGISTER_CN);
map.put(Locale.KOREA, BBS_REGISTER_KR);
map.put(Locale.JAPAN, BBS_REGISTER_JP);
map.put(Locale.US, BBS_REGISTER_EN);
map.put(Locale.TAIWAN, BBS_REGISTER_TW);
}
/**
* 云中心新账户中心链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_New_Account_Center_Default";
public BbsRegisterMark() {}
@Override
public String getValue() {
String result = map.get(GeneralContext.getLocale());
return result == null ? BBS_REGISTER_EN : result;
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
}

34
designer-base/src/main/java/com/fr/design/locale/impl/BbsResetMark.java

@ -1,13 +1,8 @@
package com.fr.design.locale.impl;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @author hades
* @version 10.0
@ -15,24 +10,21 @@ import java.util.Map;
*/
public class BbsResetMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_RESET_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "https://id.fanruan.com/forget/forget.php?clue=activityfr");
private static final String BBS_RESET_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.reset", "https://id.fanruan.com/forget/forget.php?clue=activityfr");
private static final String BBS_RESET_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php");
private static final String BBS_RESET_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php");
private static final String BBS_RESET_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.reset.en_US", "https://id.fanruan.com/en/forget/forget.php");
public BbsResetMark() {
map.put(Locale.CHINA, BBS_RESET_CN);
map.put(Locale.KOREA, BBS_RESET_KR);
map.put(Locale.JAPAN, BBS_RESET_JP);
map.put(Locale.US, BBS_RESET_EN);
map.put(Locale.TAIWAN, BBS_RESET_TW);
}
/**
* 云中心老账户中心链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Account_Center";
/**
* 云中心老账户中心链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Account_Center_Default";
public BbsResetMark() {}
@Override
public String getValue() {
String result = map.get(GeneralContext.getLocale());
return result == null ? BBS_RESET_EN : result;
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
}

34
designer-base/src/main/java/com/fr/design/locale/impl/BbsSpaceMark.java

@ -1,13 +1,8 @@
package com.fr.design.locale.impl;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.general.locale.LocaleMark;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
/**
* @author hades
* @version 10.0
@ -15,25 +10,20 @@ import java.util.Map;
*/
public class BbsSpaceMark implements LocaleMark<String> {
private final Map<Locale, String> map = new HashMap<>();
private static final String BBS_SPACE_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.default", "http://bbs.fanruan.com/home.php?mod=space&do=pm");
private static final String BBS_SPACE_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.default", "http://bbs.fanruan.com/home.php?mod=space&do=pm");
private static final String BBS_SPACE_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US", "https://community.finereport.com/home.php?mod=space&do=pm");
private static final String BBS_SPACE_KR = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US", "https://community.finereport.com/home.php?mod=space&do=pm");
private static final String BBS_SPACE_JP = CloudCenter.getInstance().acquireUrlByKind("bbs.default.en_US", "https://community.finereport.com/home.php?mod=space&do=pm");
/**
* 云中心帆软社区消息中心链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Message_Center";
public BbsSpaceMark() {
map.put(Locale.CHINA, BBS_SPACE_CN);
map.put(Locale.KOREA, BBS_SPACE_KR);
map.put(Locale.JAPAN, BBS_SPACE_JP);
map.put(Locale.US, BBS_SPACE_EN);
map.put(Locale.TAIWAN, BBS_SPACE_TW);
}
/**
* 云中心帆软社区消息中心链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Message_Center_Default";
public BbsSpaceMark() {}
@Override
public String getValue() {
String result = map.get(GeneralContext.getLocale());
return result == null ? BBS_SPACE_EN : result;
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
}

30
designer-base/src/main/java/com/fr/design/locale/impl/DataMaskMark.java

@ -0,0 +1,30 @@
package com.fr.design.locale.impl;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.general.locale.LocaleMark;
/**
* 根据图片信息生成获取国际化服务器图标工具
*
* @author obo
* @since 11.0
* Created on 2023/4/19
*/
public class DataMaskMark implements LocaleMark<String> {
/**
* 云中心数据脱敏帮助链接链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Data_Mask";
/**
* 云中心数据脱敏默认帮助链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design_Report_Desensitization_Help_Document_Url";
@Override
public String getValue() {
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
}

28
designer-base/src/main/java/com/fr/design/locale/impl/LineEngineMark.java

@ -0,0 +1,28 @@
package com.fr.design.locale.impl;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.general.locale.LocaleMark;
/**
* 根据国际化获取启用行式引擎执行层式报表帮助文档链接
*
* @author obo
* @since 11.0
* Created on 2023/4/19
*/
public class LineEngineMark implements LocaleMark<String> {
/**
* 云中心启用行式引擎执行层式报表帮助链接链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Line_Engine";
/**
* 云中心启用行式引擎执行层式报表默认帮助链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Line_Engine_Default";
@Override
public String getValue() {
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
}
}

2
designer-base/src/main/java/com/fr/design/locale/impl/VideoMark.java

@ -16,7 +16,7 @@ public class VideoMark implements LocaleMark<String> {
private Map<Locale, String> map = new HashMap<>();
private static final String VIDEO_EN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.en_US", "http://www.finereport.com/en/Learning-path");
private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_CN", "https://edu.fanruan.com/video?class1=16&class2=0");
private static final String VIDEO_CN = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_CN", "https://home.fanruan.com/finereport/video");
private static final String VIDEO_TW = CloudCenter.getInstance().acquireUrlByKind("bbs.video.zh_TW", "http://www.finereport.com/tw/video");
public VideoMark() {

2
designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java

@ -99,7 +99,7 @@ public class LockInfoDialog extends JDialog {
return;
}
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getFilePath());
TemplateUtils.createAndOpenTemplate(
TemplateUtils.createAndReOpenTemplate(
Toolkit.i18nText("Fine_Design_Template_Lock_Copy"),
new FileNodeFILE(new FileNode(selectedFilePath, false)),
false,

20
designer-base/src/main/java/com/fr/design/login/DesignerLoginBridge.java

@ -5,6 +5,7 @@ import com.fr.design.bridge.exec.JSCallback;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ilable.ActionLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.locale.impl.BbsResetMark;
@ -23,15 +24,16 @@ import com.fr.log.FineLoggerFactory;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.JSFunction;
import com.teamdev.jxbrowser.chromium.JSObject;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
/**
* @author Lanlan
@ -40,6 +42,16 @@ import javax.swing.SwingUtilities;
*/
public class DesignerLoginBridge {
/**
* 云中心组件商城模板在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Market_Template";
/**
* 云中心组件商城模板默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Market_Template_Default";
private Map<String, String> params;
public static DesignerLoginBridge getBridge(Browser browser, Map<String, String> params) {
@ -71,7 +83,7 @@ public class DesignerLoginBridge {
getHyperlinkPane(
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Guide_Login_Success_Title"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Designer_Guide_Login_Success_Hyperlink_Text"),
CloudCenter.getInstance().acquireUrlByKind("designer.premium.template", "https://market.fanruan.com/template")
LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT)
)
);
} else if (source == DesignerLoginSource.BBS_JUMP) {

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

@ -230,12 +230,11 @@ public class CenterRegionContainerPane extends JPanel {
// 颜色,字体那些按钮的工具栏
toolbarPane.add(toolbarComponent = ad.resetToolBar(toolbarComponent, plus), BorderLayout.CENTER);
if (strategy.hasToolBarPane(plus)) {
this.add(toolbarPane, BorderLayout.NORTH);
} else {
this.remove(toolbarPane);
JPanel customNorthPane = strategy.customNorthPane(toolbarPane,plus);
if (!isExist(customNorthPane)){
this.removeNorth();
this.add(customNorthPane, BorderLayout.NORTH);
}
if (strategy.hasTemplateTabPane(plus)) {
eastCenterPane.add(templateTabPane, BorderLayout.CENTER);
} else {
@ -250,6 +249,26 @@ public class CenterRegionContainerPane extends JPanel {
resetByDesignMode();
}
private void removeNorth(){
Component[] components = this.getComponents();
for(Component c : components){
if (c!= centerTemplateCardPane){
this.remove(c);
}
}
}
private boolean isExist(JPanel customNorthPane) {
Component[] components = this.getComponents();
for (Component component : components) {
if (component == customNorthPane) {
return true;
}
}
return false;
}
private void resetByDesignMode() {
if (DesignModeContext.isDuchampMode()) {
eastPane.remove(largeToolbar);
@ -292,4 +311,11 @@ public class CenterRegionContainerPane extends JPanel {
return toolbarComponentState;
}
/**
* 重置下RegionContainerpane
*/
public void resetCenterRegionContainerPane(){
templateTabPane.add(MultiTemplateTabPane.getInstance(), BorderLayout.CENTER);
}
}

8
designer-base/src/main/java/com/fr/design/mainframe/DefaultToolKitConfig.java

@ -2,6 +2,8 @@ package com.fr.design.mainframe;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import javax.swing.JPanel;
public class DefaultToolKitConfig implements ToolKitConfigStrategy {
@Override
@ -18,4 +20,10 @@ public class DefaultToolKitConfig implements ToolKitConfigStrategy {
public boolean hasToolBarPane(ToolBarMenuDockPlus plus) {
return plus.hasToolBarPane();
}
@Override
public JPanel customNorthPane(JPanel toolBarPane, ToolBarMenuDockPlus plus) {
CenterRegionContainerPane.getInstance().resetCenterRegionContainerPane();
return toolBarPane;
}
}

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

@ -852,7 +852,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (jt == null || jt.getEditingFILE() == null) {
return;
}
if (currentTemplateDeactivateFail()) {
if (currentTemplateDeactivateFail(jt)) {
return;
}
jt.addJTemplateActionListener(this);
@ -877,7 +877,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
if (jt == null || jt.getEditingFILE() == null) {
return;
}
if (currentTemplateDeactivateFail()) {
if (currentTemplateDeactivateFail(jt)) {
return;
}
getCenterTemplateCardPane().showJTemplate(jt);
@ -939,9 +939,9 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta
*
* @return 是否停用失败
*/
private boolean currentTemplateDeactivateFail() {
private boolean currentTemplateDeactivateFail(JTemplate jt) {
JTemplate currentEditingTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
return currentEditingTemplate != null && !currentEditingTemplate.deactivateTemplate();
return currentEditingTemplate != null && !currentEditingTemplate.deactivateTemplate(jt);
}

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

@ -427,7 +427,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public NewFolderAction() {
this.setName(KeySetUtils.NEW_FOLDER.getMenuKeySetName());
this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/new_folder");
this.setSmallIcon("/com/fr/design/standard/newfolder/new_folder");
}
@Override
@ -452,7 +452,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public SwitchAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Search"));
this.setMnemonic('S');
this.setSmallIcon("/com/fr/design/images/data/search");
this.setSmallIcon("/com/fr/design/standard/search", false);
}
@Override
@ -469,7 +469,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public CollapseAllAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Collapse_All"));
this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/collapse-all.png");
this.setSmallIcon("/com/fr/design/standard/collapse_all", false);
}
@Override
@ -485,7 +485,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
private class VcsAction extends UpdateAction {
public VcsAction() {
this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/vcs_list");
this.setSmallIcon("/com/fr/design/standard/vcslist/vcs_list");
}
@Override
@ -567,7 +567,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public ShowInExplorerAction() {
this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Show_In_Containing_Folder"));
this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/view_folder");
this.setSmallIcon("/com/fr/design/standard/viewfolder/view_folder");
}
@Override
@ -584,7 +584,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
public RefreshTreeAction() {
this.setName(Toolkit.i18nText("Fine-Design_Basic_Refresh"));
this.setSmallIcon("/com/fr/design/images/FileDealerPaneIcon/refresh");
this.setSmallIcon("/com/fr/design/standard/refresh", false);
}
@Override

5
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -19,6 +19,7 @@ import com.fr.design.notification.SnapChat;
import com.fr.design.notification.SnapChatFactory;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.SvgDrawUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.log.FineLoggerFactory;
@ -729,7 +730,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private Set<PropertyMode> enableModes;
// 完整icon路径为 ICON_BASE_DIR + btnIconName + iconSuffix
private static final String ICON_BASE_DIR = "/com/fr/design/images/buttonicon/propertiestab/";
private static final String ICON_BASE_DIR = "/com/fr/design/standard/propertiestab/";
private static final String ICON_SUFFIX_NORMAL = "_normal.svg";
private static final String ICON_SUFFIX_DISABLED = "_disabled.svg";
private static final String ICON_SUFFIX_SELECTED = "_selected.svg";
@ -1313,7 +1314,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
} else {
button = UIConstants.POP_BUTTON_UP;
}
g.drawImage(button, ARROW_RANGE_START + 8, 4, 16, 16, null);
SvgDrawUtils.doDrawSVG(g, () -> SvgDrawUtils.drawImage(g, button, (ARROW_RANGE_START + 8), 4, null));
}
}

182
designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.Parameter;
import com.fr.base.TRL;
import com.fr.base.extension.FileExtension;
@ -8,6 +7,7 @@ import com.fr.base.io.BaseBook;
import com.fr.base.iofile.attr.DesignBanCopyAttrMark;
import com.fr.base.iofile.attr.TemplateIdAttrMark;
import com.fr.base.iofile.attr.TemplateThemeAttrMark;
import com.fr.base.svg.IconUtils;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.base.theme.TemplateThemeConfig;
@ -58,9 +58,12 @@ import com.fr.design.module.DesignModuleFactory;
import com.fr.design.preview.PagePreview;
import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.TemplateUtils;
import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.design.worker.save.EmptyCallBackSaveWorker;
import com.fr.design.worker.save.SaveFailureHandler;
import com.fr.design.worker.save.type.SaveType;
import com.fr.design.worker.save.type.SaveTypeWorker;
import com.fr.design.write.submit.DBManipulationInWidgetEventPane;
import com.fr.design.write.submit.DBManipulationPane;
import com.fr.event.EventDispatcher;
@ -72,7 +75,6 @@ import com.fr.file.StashedFILE;
import com.fr.form.ui.NoneWidget;
import com.fr.form.ui.Widget;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.locale.InterProviderFactory;
import com.fr.log.FineLoggerFactory;
import com.fr.nx.app.designer.toolbar.TemplateTransformer;
@ -119,6 +121,8 @@ import java.util.concurrent.Callable;
* 报表设计和表单设计的编辑区域(设计器编辑的IO文件)
*/
public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>> extends TargetComponent<T> implements ToolBarMenuDockPlus, DesignerProxy, JTemplateSave, TabChangeListener, ThemedTemplate {
private static final String DEFAULT_TAB_OPERATOR = "DefaultTabOperator";
// TODO ALEX_SEP editingFILE这个属性一定要吗?如果非要不可,有没有可能保证不为null
private static final int PREDEFINED_ICON_WIDTH = 27;
@ -1369,6 +1373,17 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
/**
* 将要激活打开其他模板使当前模板灭活
* 默认 do nothing 返回true
*
* @return true成功停用当前模板
*/
public boolean deactivateTemplate(JTemplate jTemplate) {
//兼容调用老的接口
return deactivateTemplate();
}
/**
* 返回当前支持的超链界面pane
*
@ -1425,7 +1440,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public Icon getPreviewLargeIcon() {
PreviewProvider provider = getPreviewType();
String iconPath = provider.iconPathForLarge();
return BaseUtils.readIcon(iconPath);
return IconUtils.readIcon(iconPath);
}
/**
@ -1573,7 +1588,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
protected UIButton createTemplateThemeButton() {
UIButton button = new UIButton(IOUtils.readIcon("/com/fr/design/icon/icon_predefined_style.png")) {
UIButton button = new UIButton(IconUtils.readIcon("/com/fr/design/standard/template_theme")) {
@Override
public Dimension getPreferredSize() {
FontMetrics metrics = getFontMetrics(getFont());
@ -1688,24 +1703,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
if (!editingFILE.exists()) {
return saveAs(showLoc);
}
CallbackSaveWorker worker = new CallbackSaveWorker(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return saveRealFileByWorker();
}
}, this);
worker.addSuccessCallback(new Runnable() {
@Override
public void run() {
callBackForSave();
//在保存后的回调中执行预编译流程
CptCompileUtil.compile(JTemplate.this);
}
});
return worker;
return getSaveCallBackSaveWorker();
}
/**
@ -1751,6 +1749,8 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
}
private CallbackSaveWorker saveAs(boolean showLoc) {
FILE editingFILE = this.getEditingFILE();
if (editingFILE == null) {
@ -1772,7 +1772,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
// 目标文件
editingFILE = fileChooser.getSelectedFILE();
}
FILE finalEditingFILE = editingFILE;
CallbackSaveWorker worker = new CallbackSaveWorker(new Callable<Boolean>() {
@Override
@ -1873,10 +1872,95 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
return saveAs(true);
}
/**
* 获取保存用到的saveWorker
*/
private CallbackSaveWorker getSaveCallBackSaveWorker() {
CallbackSaveWorker worker = new CallbackSaveWorker(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return saveRealFileByWorker();
}
}, this);
worker.addSuccessCallback(new Runnable() {
@Override
public void run() {
callBackForSave();
//在保存后的回调中执行预编译流程
CptCompileUtil.compile(JTemplate.this);
}
});
return worker;
}
/**
* 获取保存的类别执行的callable
*/
private Callable<SaveType.TypeEnum> getSaveTypeCallable() {
return () -> {
fireJTemplateSaveBefore();
FILE editingFILE = getEditingFILE();
// carl:editingFILE没有,当然不存了,虽然不会有这种情况
if (editingFILE == null) {
return SaveType.TypeEnum.EMPTY;
}
// 检查一下editingFILE是不是已存在的文件,如果不存在则用saveAs
if (!editingFILE.exists()) {
return SaveType.TypeEnum.SAVE_AS;
}
return SaveType.TypeEnum.SAVE;
};
}
/**
* 根据保存类型获取对应的saveWorker
*
* @param saveType 保存类型
*/
private CallbackSaveWorker getSaveTypeWorker(SaveType saveType) {
CallbackSaveWorker callbackSaveWorker;
switch (saveType.getType()) {
case EMPTY:
callbackSaveWorker = new EmptyCallBackSaveWorker();
break;
case SAVE:
callbackSaveWorker = getSaveCallBackSaveWorker();
break;
default:
callbackSaveWorker = saveAs(true);
}
return callbackSaveWorker;
}
@Override
public void saveDirectly() {
CallbackSaveWorker worker = save();
worker.start(getRuntimeId());
new SaveTypeWorker(getSaveTypeCallable(), this) {
@Override
protected void done() {
try {
SaveType saveType = get();
CallbackSaveWorker callbackSaveWorker = getSaveTypeWorker(saveType);
//告诉一下后面执行的saveWorker,当前判断文件是否存在的操作是否已经进行了开始转圈的那个等待动画,避免重复
callbackSaveWorker.setSlowly(saveType.isSlowly());
callbackSaveWorker.start(getRuntimeId());
//如果是空也就是不保存,需要恢复一下界面(如果saveTypeWorker里进行了操作的话)
if (callbackSaveWorker instanceof EmptyCallBackSaveWorker) {
setSaving(false);
if (saveType.isSlowly()) {
if (ComparatorUtils.equals(getName(), HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().getName())) {
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().hideCover();
}
}
DesignerFrameFileDealerPane.getInstance().stateChange();
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
}
}.start();
}
@Override
@ -1980,7 +2064,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public void setDesignerUIMode() {
DesignerUIModeConfig.getInstance().setAbsoluteMeasureUIMode();
}
/**
* 判断当前的模板是否是有效的模板
*
@ -1990,4 +2074,50 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public static boolean isValid(JTemplate jt) {
return jt != null && jt != JNullTemplate.NULL;
}
/**
* 获取此模板所使用的tab栏操作类型
* @return
*/
public String getTemplateTabOperatorType(){
return DEFAULT_TAB_OPERATOR;
}
/**
* 当前模板是否可以被保存
* @return /
*/
public boolean canBeSaved(){
return true;
}
/**
* 当前的模板是否支持缓存
*
* @return /
*/
public boolean supportCache(){
return true;
}
/**
* 获取此模板在tab栏中显示的名称
* @return
*/
public String getTabShowName(JTemplate<?, ?> jTemplate){
String name = TemplateUtils.createLockeTemplatedName(jTemplate, jTemplate.getTemplateName());
if (!jTemplate.isSaved() && !name.endsWith(" *")) {
name += " *";
}
return name;
}
/**
* 切换环境之前是否需要保存
* @return
*/
public boolean needSaveBeforeSwitchEnv(){
return false;
}
}

8
designer-base/src/main/java/com/fr/design/mainframe/ToolBarNewTemplatePane.java

@ -1,6 +1,6 @@
package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.file.NewTemplatePane;
import javax.swing.Icon;
@ -21,16 +21,16 @@ public class ToolBarNewTemplatePane extends NewTemplatePane {
@Override
public Icon getNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/addicon.png");
return IconUtils.readIcon("/com/fr/design/standard/addicon/addicon");
}
@Override
public Icon getMouseOverNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
return IconUtils.readIcon("/com/fr/design/standard/addicon/add_press.svg");
}
@Override
public Icon getMousePressNew() {
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/add_press.png");
return IconUtils.readIcon("/com/fr/design/standard/addicon/add_press.svg");
}
}

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

@ -2,6 +2,9 @@ package com.fr.design.mainframe;
import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus;
import javax.swing.JPanel;
public interface ToolKitConfigStrategy {
/**
@ -24,4 +27,11 @@ public interface ToolKitConfigStrategy {
* @return
*/
boolean hasToolBarPane(ToolBarMenuDockPlus plus);
/**
* 定制工具栏
* @param toolBarPane
* @param plus
* @return
*/
JPanel customNorthPane(JPanel toolBarPane, ToolBarMenuDockPlus plus);
}

3
designer-base/src/main/java/com/fr/design/mainframe/check/CheckButton.java

@ -1,6 +1,7 @@
package com.fr.design.mainframe.check;
import com.fr.base.BaseUtils;
import com.fr.base.svg.IconUtils;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
@ -44,7 +45,7 @@ public class CheckButton extends UIButton {
private UILabel imageLabel;
public CheckButton() {
this.setIcon(BaseUtils.readIcon("/com/fr/design/images/buttonicon/check.png"));
this.setIcon(IconUtils.readIcon("/com/fr/design/standard/font_miss_check"));
this.setToolTipText(Toolkit.i18nText("Fine_Designer_Check_Font"));
this.set4ToolbarButton();
this.addActionListener(checkListener);

16
designer-base/src/main/java/com/fr/design/mainframe/check/CheckFontInfoDialog.java

@ -4,10 +4,10 @@ import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.DesignSizeI18nManager;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.CloudCenter;
import com.fr.general.IOUtils;
import javax.swing.BorderFactory;
@ -39,17 +39,27 @@ public class CheckFontInfoDialog extends JDialog implements ActionListener {
private UILabel directUiLabel;
private UILabel detailLabel;
/**
* 云中心插件管理帮助文档在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Server_Install_Font";
/**
* 云中心插件管理默认帮助文档在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Server_Install_Font_Default";
public CheckFontInfoDialog(Frame parent, String areaText) {
super(parent,true);
//提示信息
JPanel imagePanel = new JPanel();
imageLabel = new UILabel(IOUtils.readIcon("com/fr/design/images/warnings/warning32.png"));
imagePanel.add(imageLabel);
String link = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
JPanel messagePanel = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true);
MessageWithLink linkMessage = new MessageWithLink(Toolkit.i18nText("Fine_Designer_Check_Font_Message"),
Toolkit.i18nText("Fine_Designer_Check_Font_Install_Font"),
CloudCenter.getInstance().acquireUrlByKind("help.install.font", "https://help.fanruan.com/finereport/doc-view-3999.html"));
link);
linkMessage.setPreferredSize(DesignSizeI18nManager.getInstance().i18nDimension("com.fr.design.mainframe.check.CheckFontInfoDialog.messageWithLink"));
messagePanel.add(linkMessage);

4
designer-base/src/main/java/com/fr/design/mainframe/manager/search/searcher/control/pane/TemplateTreeSearchToolbarPane.java

@ -107,7 +107,7 @@ public class TemplateTreeSearchToolbarPane extends JPanel implements TreeSearchS
searchPane.setBorder(BorderFactory.createLineBorder(UIConstants.TOOLBAR_BORDER_COLOR));
searchPane.setBackground(Color.WHITE);
// 左侧搜索图标
UILabel searchLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/data/search"));
UILabel searchLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/search"));
searchLabel.setBorder(BorderFactory.createEmptyBorder(0, 12, 0, 0));
searchLabel.addMouseListener(new MouseAdapter() {
@Override
@ -118,7 +118,7 @@ public class TemplateTreeSearchToolbarPane extends JPanel implements TreeSearchS
// 中间输入框
initSearchTextField();
// 右侧返回图标
UILabel returnLabel = new UILabel(IconUtils.readIcon("/com/fr/design/images/data/clear"));
UILabel returnLabel = new UILabel(IconUtils.readIcon("/com/fr/design/standard/clear"));
returnLabel.setToolTipText(Toolkit.i18nText("Fine-Design_Tree_Search_Return"));
returnLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 11));
returnLabel.addMouseListener(new MouseAdapter() {

6
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -42,6 +42,7 @@ import com.fr.design.actions.server.GlobalTableDataAction;
import com.fr.design.actions.server.PlatformManagerAction;
import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor;
@ -275,7 +276,10 @@ public abstract class ToolBarMenuDock {
insertTemplateExtendMenu(plus, menuDefs);
// 添加模板菜单
menuList.addAll(Arrays.asList(menuDefs));
// 如果是JNullTemplate不能添加模板菜单,之前没有这个JNullTemplate所以没考虑
if (JTemplate.isValid(HistoryTemplateListCache.getInstance().getCurrentEditingTemplate())) {
menuList.addAll(Arrays.asList(menuDefs));
}
// 添加服务器菜单
if (WorkContext.getCurrent() != null && WorkContext.getCurrent().isRoot()) {

33
designer-base/src/main/java/com/fr/design/menu/MenuDef.java

@ -3,25 +3,32 @@ package com.fr.design.menu;
import com.fr.base.svg.IconUtils;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.*;
import com.fr.design.gui.imenu.UIHeadMenu;
import com.fr.design.gui.imenu.UIMenu;
import com.fr.design.gui.imenu.UIPopupEastAttrMenu;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.gui.imenu.UIScrollMenu;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import java.util.HashSet;
import java.util.Set;
import javax.swing.*;
import javax.swing.JMenu;
import javax.swing.JPopupMenu;
import javax.swing.JToolBar;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import java.awt.*;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ContainerListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Define Menu.
@ -46,6 +53,7 @@ public class MenuDef extends ShortCut {
protected Boolean isEastAttr = false;
protected char mnemonic;
protected String iconPath;
private boolean needDisabled;
protected String tooltip;
//item List.
private List<ShortCut> shortcutList = new ArrayList<ShortCut>();
@ -112,9 +120,19 @@ public class MenuDef extends ShortCut {
}
public void setIconPath(String iconPath) {
this.iconPath = iconPath;
setDisabledIcon(iconPath, false);
}
/**
* 设置不可用图标时,注意传递路径问题,若路径为"view_normal.svg",请传递"view",不带后缀
* 读取disable图标的文件名应当为"xxx_disabled.svg",也是项目中的svg命名规范
* 注意必须是svg图标路径才能使用此函数设置正常和禁用状态
*
* */
public void setDisabledIcon(String iconPath, boolean needDisabled) {
this.iconPath = iconPath;
this.needDisabled = needDisabled;
}
public int getShortCutCount() {
return this.shortcutList.size();
}
@ -183,6 +201,9 @@ public class MenuDef extends ShortCut {
if (createdButton == null) {
if (iconPath != null) {
createdButton = new UIButton(IconUtils.readIcon(iconPath));
if(needDisabled) {
createdButton.setDisabledIcon(IconUtils.readIcon(iconPath + IconUtils.ICON_TYPE_DISABLED));
}
createdButton.set4ToolbarButton();
} else {
createdButton = new UIButton(name);

7
designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterPane.java

@ -1,5 +1,6 @@
package com.fr.design.notification.ui;
import com.fr.base.svg.IconUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
@ -20,7 +21,7 @@ public class NotificationCenterPane extends BasicPane {
setPreferredSize(new Dimension(24, 24));
setLayout(new BorderLayout());
notificationCenterButton = new UIButton();
notificationCenterButton.setIcon(IOUtils.readIcon("/com/fr/design/notification/ui/notificationCenter.png"));
notificationCenterButton.setIcon(IconUtils.readIcon("/com/fr/design/standard/notification/notification"));
notificationCenterButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Show_Notification"));
notificationCenterButton.set4ToolbarButton();
notificationCenterButton.setRolloverEnabled(false);
@ -41,9 +42,9 @@ public class NotificationCenterPane extends BasicPane {
public void refreshButton() {
if (NotificationCenter.getInstance().getNotificationsCount() > 0) {
notificationCenterButton.setIcon(IOUtils.readIcon("/com/fr/design/notification/ui/notificationCenterDot.png"));
notificationCenterButton.setIcon(IconUtils.readIcon("/com/fr/design/standard/notification/notification_dot.svg"));
} else {
notificationCenterButton.setIcon(IOUtils.readIcon("/com/fr/design/notification/ui/notificationCenter.png"));
notificationCenterButton.setIcon(IconUtils.readIcon("/com/fr/design/standard/notification/notification"));
}
}

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

@ -18,12 +18,12 @@ public class FormPreview extends AbstractPreviewProvider {
@Override
public String iconPathForPopupItem() {
return "com/fr/design/images/buttonicon/runs.png";
return "/com/fr/design/standard/preview/runs.svg";
}
@Override
public String iconPathForLarge() {
return "com/fr/design/images/buttonicon/run24.png";
return "/com/fr/design/standard/preview/run24.svg";
}
@Override

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

@ -19,12 +19,12 @@ public class MobilePreview extends AbstractPreviewProvider {
@Override
public String iconPathForPopupItem() {
return "com/fr/design/images/buttonicon/mobile.png";
return "/com/fr/design/standard/preview/mobile.svg";
}
@Override
public String iconPathForLarge() {
return "com/fr/design/images/buttonicon/mobileb24.png";
return "/com/fr/design/standard/preview/mobileb24.svg";
}
@Override

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

@ -17,12 +17,12 @@ public class PagePreview extends AbstractPreviewProvider {
@Override
public String iconPathForPopupItem() {
return "com/fr/design/images/buttonicon/pages.png";
return "/com/fr/design/standard/preview/pages.svg";
}
@Override
public String iconPathForLarge() {
return "com/fr/design/images/buttonicon/pageb24.png";
return "/com/fr/design/standard/preview/pageb24.svg";
}
@Override

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

@ -20,12 +20,12 @@ public class ViewPreview extends AbstractPreviewProvider {
@Override
public String iconPathForPopupItem() {
return "com/fr/design/images/buttonicon/anas.png";
return "/com/fr/design/standard/preview/anas.svg";
}
@Override
public String iconPathForLarge() {
return "com/fr/design/images/buttonicon/anab24.png";
return "/com/fr/design/standard/preview/anab24.svg";
}
@Override

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

@ -20,12 +20,12 @@ public class WritePreview extends AbstractPreviewProvider {
@Override
public String iconPathForPopupItem() {
return "com/fr/design/images/buttonicon/writes.png";
return "/com/fr/design/standard/preview/writes.svg";
}
@Override
public String iconPathForLarge() {
return "com/fr/design/images/buttonicon/writeb24.png";
return "/com/fr/design/standard/preview/writeb24.svg";
}
@Override

2
designer-base/src/main/java/com/fr/design/style/color/UIToolbarColorButton.java

@ -35,7 +35,7 @@ public class UIToolbarColorButton extends UICombinationButton implements PopupHi
private UIObserverListener uiObserverListener;
public UIToolbarColorButton(Icon icon) {
super(new UIColorButton(icon), new UIButton(IconUtils.readIcon("/com/fr/design/images/gui/popup")));
super(new UIColorButton(icon), new UIButton(IconUtils.readIcon("/com/fr/design/standard/popup")));
getLeftButton().setEventBanned(true);
getRightButton().addFocusListener(new FocusListener() {

20
designer-base/src/main/java/com/fr/design/update/actions/NewFeatureAction.java

@ -1,9 +1,8 @@
package com.fr.design.update.actions;
import com.fr.common.util.Strings;
import com.fr.design.i18n.LocaleLinkProvider;
import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import com.fr.log.FineLoggerFactory;
import java.awt.event.ActionEvent;
@ -16,17 +15,22 @@ import java.awt.event.ActionListener;
* */
public class NewFeatureAction implements ActionListener {
/**
* 云中心更新日志索引在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Latest_Update_Detail";
public static String DEFAULT_UPDATE_DETAIL_URL = "https://help.fanruan.com/finereport/doc-view-4699.html";
/**
* 云中心更新日志索引默认链接在配置文件中对应的配置文件key
*/
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Latest_Update_Detail_Default";
public static String DEFAULT_UPDATE_DETAIL_URL = LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT);
@Override
public void actionPerformed(ActionEvent e) {
try {
String url = CloudCenter.getInstance().acquireConf("fr.latest.update.detil");
if (Strings.isEmpty(url)) {
url = DEFAULT_UPDATE_DETAIL_URL;
}
BrowseUtils.browser(url);
BrowseUtils.browser(DEFAULT_UPDATE_DETAIL_URL);
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage());
}

16
designer-base/src/main/java/com/fr/design/utils/SvgDraw.java

@ -0,0 +1,16 @@
package com.fr.design.utils;
/**
* 绘制SVG图标的函数式接口
*
* @author obo
* @since 11.0
* Created on 2023/3/24
*/
public interface SvgDraw<T> {
/**
* 绘制svg图标的具体逻辑,方法体
* */
void drawSVG();
}

73
designer-base/src/main/java/com/fr/design/utils/SvgDrawUtils.java

@ -0,0 +1,73 @@
package com.fr.design.utils;
import com.fr.base.svg.SVGLoader;
import com.fr.base.svg.SystemScaleUtils;
import org.jetbrains.annotations.NotNull;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.ImageObserver;
/**
* 用于绘制svg图片缩放(高分屏下)
*
* @author hades
* @since 11.0
* Created on 2022/5/6
*/
public class SvgDrawUtils {
private static final boolean HI_DPI_ENABLED = SystemScaleUtils.isJreHiDPIEnabled();
/**
* 绘制svg前若环境支持高清化则对缩放比例进行适配
* */
public static void beforeDraw(Graphics2D g2) {
if (HI_DPI_ENABLED) {
g2.scale(1 / SVGLoader.SYSTEM_SCALE, 1 / SVGLoader.SYSTEM_SCALE);
}
}
/**
* 绘制svg后还原缩放矩阵
* */
public static void afterDraw(Graphics2D g2) {
if (HI_DPI_ENABLED) {
g2.scale(SVGLoader.SYSTEM_SCALE, SVGLoader.SYSTEM_SCALE);
}
}
/**
* 计算高缩放下绘制svg图标时新的的位置x,y
* @param position 旧坐标的值
* @return 新的position值
* */
public static int calculatePosition(int position) {
return HI_DPI_ENABLED ? (int) (position * SVGLoader.SYSTEM_SCALE) : position;
}
/**
* 绘制svg图像的完整逻辑
* @param graphics 绘图
* @param svgDraw 具体绘制逻辑
* */
public static void doDrawSVG(@NotNull Graphics graphics, @NotNull final SvgDraw<Graphics> svgDraw) {
SvgDrawUtils.beforeDraw((Graphics2D) graphics);
svgDraw.drawSVG();
SvgDrawUtils.afterDraw((Graphics2D) graphics);
}
/**
* 绘制前对坐标x和y进行处理
* @param graphics 绘图
* @param image svg的Image对象
* @param x x坐标
* @param y y坐标
* @param imageObserver 图像观察器
* */
public static void drawImage(Graphics graphics, Image image, int x, int y, ImageObserver imageObserver) {
//如果环境支持高清化,在调整缩放比例时绘制svg会影响到位置的变化,若图标无确定裁剪位置,则需要进行调整
graphics.drawImage(image, SvgDrawUtils.calculatePosition(x), SvgDrawUtils.calculatePosition(y), imageObserver);
}
}

28
designer-base/src/main/java/com/fr/design/utils/SvgPaintUtils.java

@ -1,28 +0,0 @@
package com.fr.design.utils;
import com.fr.base.svg.SVGLoader;
import com.fr.base.svg.SystemScaleUtils;
import java.awt.Graphics2D;
/**
* 用于绘制svg图片缩放(高分屏下)
*
* @author hades
* @version 11.0
* Created by hades on 2022/5/6
*/
public class SvgPaintUtils {
public static void beforePaint(Graphics2D g2) {
if (SystemScaleUtils.isJreHiDPIEnabled()) {
g2.scale(1 / SVGLoader.SYSTEM_SCALE, 1 / SVGLoader.SYSTEM_SCALE);
}
}
public static void afterPaint(Graphics2D g2) {
if (SystemScaleUtils.isJreHiDPIEnabled()) {
g2.scale(SVGLoader.SYSTEM_SCALE, SVGLoader.SYSTEM_SCALE);
}
}
}

186
designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java

@ -16,12 +16,16 @@ import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils;
import com.fr.stable.CoreConstants;
import com.fr.stable.ProductConstants;
import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.lock.TplOperator;
import org.jetbrains.annotations.Nullable;
import javax.swing.SwingWorker;
import java.io.OutputStream;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
@ -33,22 +37,81 @@ public class TemplateUtils {
/**
* 创建新的模板文件并打开模板
* @param prefix 模板文件名称前缀
* @param file 模板文件
*
* @param prefix 模板文件名称前缀
* @param file 模板文件
* @param createByEditingTemplate 是否根据 当前编辑模板 来创建新模板
* 为true时以CurrentEditingTemplate为准创建新模板
* 为false时以传入的File文件为准创建新模板此文件可以不是编辑状态
* @param openNewTemplate 是否需要在创建后打开模板
* @param openNewTemplate 是否需要在创建后打开模板
*/
public static void createAndOpenTemplate(String prefix, FILE file, boolean createByEditingTemplate, boolean openNewTemplate) {
String fileName = file.getName();
createAndOpenTemplate(prefix, file, createByEditingTemplate, openNewTemplate, null);
}
/**
* 创建新的模板文件并并判断新的模板文件是否之前已经被开打如果已经打开需要reOpen
*
* @param prefix 模板文件名称前缀
* @param file 模板文件
* @param createByEditingTemplate 是否根据 当前编辑模板 来创建新模板
* 为true时以CurrentEditingTemplate为准创建新模板
* 为false时以传入的File文件为准创建新模板此文件可以不是编辑状态
* @param openNewTemplate 是否需要在创建后打开模板
*/
public static void createAndReOpenTemplate(String prefix, FILE file, boolean createByEditingTemplate, boolean openNewTemplate) {
String oldPath = file.getPath();
file = getSavedFile(prefix, file);
if (file == null) {
return;
}
Runnable doAfterCreateTemplate;
//判断一下要保存的文件是否已打开
int index = HistoryTemplateListCache.getInstance().contains(file);
JTemplate template = null;
if (index != -1) {
template = HistoryTemplateListCache.getInstance().getHistoryList().get(index);
}
createAndOpenTemplate0(file, oldPath, createByEditingTemplate, openNewTemplate, template);
}
/**
* 创建新的模板文件并打开模板并在创建备份模板成功后执行doAfterCreate
*
* @param prefix 模板文件名称前缀
* @param file 模板文件
* @param createByEditingTemplate 是否根据 当前编辑模板 来创建新模板
* 为true时以CurrentEditingTemplate为准创建新模板
* 为false时以传入的File文件为准创建新模板此文件可以不是编辑状态
* @param openNewTemplate 是否需要在创建后打开模板
* @param template 备份成功后需要关闭的模板
*/
public static void createAndOpenTemplate(String prefix, FILE file, boolean createByEditingTemplate, boolean openNewTemplate, @Nullable JTemplate<?, ?> template) {
String oldPath = file.getPath();
file = getSavedFile(prefix, file);
if (file == null) {
return;
}
createAndOpenTemplate0(file, oldPath, createByEditingTemplate, openNewTemplate, template);
}
/**
* 返回值可以为null, 为null表示没有点击保存按钮或者传递进来的文件file本身不满足格式要求
*
* @param prefix 模板文件名称前缀
* @param file 模板文件
* @return 最后选择的要保存的文件
*/
@Nullable
private static FILE getSavedFile(String prefix, FILE file) {
String fileName = file.getName();
int indexOfLastDot = fileName.lastIndexOf(CoreConstants.DOT);
if (indexOfLastDot < 0) {
return;
return null;
}
String suffix = fileName.substring(indexOfLastDot + 1);
FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true);
FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(true, true);
fileChooserPane.setFileNameTextField(prefix + fileName, suffix);
FileExtension fileExtension = FileExtension.parse(suffix);
fileChooserPane.addChooseFILEFilter(new ChooseFileFilter(fileExtension, ProductConstants.APP_NAME + Toolkit.i18nText("Fine-Design_Report_Template_File")));
@ -57,36 +120,38 @@ public class TemplateUtils {
fileChooserPane.enableFileNameTextFiled();
if (isCancel(result)) {
return;
return null;
}
if (isOk(result)) {
file = fileChooserPane.getSelectedFILE();
_createAndOpenTemplate(file, oldPath, createByEditingTemplate, openNewTemplate);
return fileChooserPane.getSelectedFILE();
}
}
private static void _createAndOpenTemplate(FILE file, String oldPath, boolean createByEditingTemplate, boolean openNewTemplate){
new SwingWorker<Void, Void>() {
return null;
}
@Override
protected Void doInBackground() throws Exception {
byte[] content = new byte[0];
if (createByEditingTemplate) {
// 从当前编辑模板中生成备份文件
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
content = template.exportData();
} else {
content = WorkContext.getWorkResource().readFully(oldPath);
}
if (ArrayUtils.isEmpty(content)) {
throw new Exception(oldPath + " content is empty" );
}
/**
* 生成备份模板
*
* @param file saveAs的模板文件
* @param createByEditingTemplate 是否根据 当前编辑模板 来创建新模板
* 为true时以CurrentEditingTemplate为准创建新模板
* 为false时以传入的File文件为准创建新模板此文件可以不是编辑状态
* @param oldPath 被saveAs的文件路径
*/
private static CompletableFuture<Boolean> createTemplate(FILE file, String oldPath, boolean createByEditingTemplate) {
return CompletableFuture.supplyAsync(() -> {
try {
// 读取模板数据
byte[] content = getTemplateData(createByEditingTemplate, oldPath);
OutputStream out = null;
try {
// 加锁
WorkContext.getCurrent().get(TplOperator.class).saveAs(file.getPath());
boolean saveAsLock = WorkContext.getCurrent().get(TplOperator.class).saveAs(file.getPath());
if (!saveAsLock) {
// 加锁失败时,直接返回
throw new RuntimeException("[RemoteDesign] back up template file failed");
}
out = file.asOutputStream();
out.write(content);
} finally {
@ -98,19 +163,45 @@ public class TemplateUtils {
// 解锁
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath());
}
}
return null;
return true;
} catch (Exception e) {
SaveFailureHandler.getInstance().process(e);
FineLoggerFactory.getLogger().error(e.getMessage(), e);
return false;
}
});
}
/**
* 打开saveAs的新模板并关闭指定的旧模板
*
* @param file 模板文件
* @param openNewTemplate 是否需要打开新模板
* @param template 需要关闭的模板
*/
private static void openNewTemplateAndCloseOldTemplate(FILE file, boolean openNewTemplate, @Nullable JTemplate<?, ?> template) {
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
if (JTemplate.isValid(template)) {
//给要关闭的模板解锁
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath());
return true;
}
return false;
}
@Override
protected void done() {
try {
get();
if (get()) {
//模板释放锁成功后关闭该模板
HistoryTemplateListCache.getInstance().closeSelectedReport(template);
}
if (openNewTemplate) {
DesignerContext.getDesignerFrame().openTemplate(file);
}
// 备份成功刷新下目录树 展示出来备份的模板
// 刷新下目录树
TemplateTreePane.getInstance().refresh();
} catch (Exception e) {
SaveFailureHandler.getInstance().process(e);
@ -118,7 +209,40 @@ public class TemplateUtils {
}
}
}.execute();
}
private static void createAndOpenTemplate0(FILE file, String oldPath, boolean createByEditingTemplate, boolean openNewTemplate, @Nullable JTemplate<?, ?> template) {
createTemplate(file, oldPath, createByEditingTemplate).thenApply((Function<Boolean, Void>) aBoolean -> {
if (aBoolean) {
openNewTemplateAndCloseOldTemplate(file, openNewTemplate, template);
}
return null;
});
}
/**
* 读取模板文件数据
*
* @param readCurrentEditingTemplate 是否读取当前编辑模板
* @param path 模板路径
* @return 模板文件数据
*/
private static byte[] getTemplateData(boolean readCurrentEditingTemplate, String path) throws Exception {
byte[] content = new byte[0];
if (readCurrentEditingTemplate) {
// 从当前编辑模板中读取模板文件数据
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (JTemplate.isValid(template)) {
content = template.exportData();
}
} else {
// 从给定的模板路径中读取模板文件数据
content = WorkContext.getWorkResource().readFully(path);
}
if (ArrayUtils.isEmpty(content)) {
throw new Exception(StringUtils.messageFormat("{} content is empty", path));
}
return content;
}
private static boolean isCancel(int result) {

16
designer-base/src/main/java/com/fr/design/widget/btn/ButtonConstants.java

@ -44,4 +44,20 @@ public class ButtonConstants {
StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.TREE_NODE_TOGGLE_BUTTON, Widget.class)
};
public static final String[] TYPES_BUTTON_NO_FREE = {
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Common"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Utils_Insert_Row"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Utils_Delete_Row"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Type_Parameter_Submit"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_TreeNode")
};
public static final Class[] CLASSES_BUTTON_NO_FREE = {
Button.class,
StableFactory.getMarkedClass(BridgeMark.APPEND_ROW_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.DELETE_ROW_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.SUBMIT_BUTTON, Widget.class),
StableFactory.getMarkedClass(BridgeMark.TREE_NODE_TOGGLE_BUTTON, Widget.class)
};
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save