Browse Source

Merge remote-tracking branch 'origin/feature/x' into feature/x

feature/x
Crawford.Zhou 10 months ago
parent
commit
3ce1ce0d45
  1. 7
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 5
      designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java
  3. 14
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  4. 6
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  5. 4
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  6. 64
      designer-base/src/main/java/com/fr/design/lock/LockFileReSaveEnum.java
  7. 46
      designer-base/src/main/java/com/fr/design/lock/LockInfoDialog.java
  8. 13
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateConfigManager.java
  9. 32
      designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java
  10. 32
      designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java
  11. 2
      designer-base/src/main/java/com/fr/startup/metric/DesignerStartupModel.java
  12. 12
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/DesktopWidgetStyleEditPane.java
  13. 15
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/MobileWidgetStyleEditPane.java
  14. 18
      designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java
  15. 70
      designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetTextStylePane.java
  16. 40
      designer-base/src/main/java/com/fr/widgettheme/util/ThemeTextStylePaneCreator.java
  17. 41
      designer-base/src/test/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPaneTest.java
  18. 41
      designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java
  19. 5
      designer-form/src/main/java/com/fr/design/widgettheme/LabelSettingPane.java
  20. 11
      designer-form/src/main/java/com/fr/design/widgettheme/ParaButtonSettingPane.java
  21. 11
      designer-form/src/main/java/com/fr/design/widgettheme/ParaEditorSettingPane.java
  22. 12
      designer-form/src/main/java/com/fr/design/widgettheme/ParaTreeEditorSettingPane.java
  23. 11
      designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java
  24. 13
      designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java
  25. 2
      designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java
  26. 8
      designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java
  27. 1
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java
  28. 2
      designer-realize/src/main/java/com/fr/strongest/WidgetThemeListenerStarter.java

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

@ -899,13 +899,18 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter, AsyncXmlReada
} }
public boolean isCloudAnalyticsDelay() { public boolean isCloudAnalyticsDelay() {
return designerPushUpdateConfigManager.isCloudAnalyticsDelay(); return designerPushUpdateConfigManager.isCloudAnalyticsDelay() || designerPushUpdateConfigManager.isUseCloudAnalyticsDelayFirst();
} }
public void setCloudAnalyticsDelay(boolean cloudAnalyticsDelay) { public void setCloudAnalyticsDelay(boolean cloudAnalyticsDelay) {
designerPushUpdateConfigManager.setCloudAnalyticsDelay(cloudAnalyticsDelay); designerPushUpdateConfigManager.setCloudAnalyticsDelay(cloudAnalyticsDelay);
} }
public void setUseCloudAnalyticsDelayFirst(boolean useCloudAnalyticsDelayFirst) {
designerPushUpdateConfigManager.setUseCloudAnalyticsDelayFirst(useCloudAnalyticsDelayFirst);
}
/** /**
* 设计器登录相关配置 * 设计器登录相关配置
*/ */

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

@ -1122,7 +1122,10 @@ public class PreferencePane extends BasicPane {
designerEnvManager.setUseOptimizedUPM4Adapter(optimizedUPMFlag); designerEnvManager.setUseOptimizedUPM4Adapter(optimizedUPMFlag);
//只有取消掉使用新插件管理器这个选项才需要把useNewPluginFirst置false(意味着用户手动配置了,如果勾选着的话,这个useNewPluginFirst为true就行了) //只有取消掉使用新插件管理器这个选项才需要把useNewPluginFirst置false(意味着用户手动配置了,如果勾选着的话,这个useNewPluginFirst为true就行了)
designerEnvManager.setUseNewPluginFirst(optimizedUPMFlag); designerEnvManager.setUseNewPluginFirst(optimizedUPMFlag);
designerEnvManager.setCloudAnalyticsDelay(this.cloudAnalyticsDelayCheckBox.isSelected()); boolean cloudDelayFlag = this.cloudAnalyticsDelayCheckBox.isSelected();
designerEnvManager.setCloudAnalyticsDelay(cloudDelayFlag);
// cloudDelayFlag默认为true,如果用户手动配置过才会是false,则后续的云端运维配置都按照用户意愿来
designerEnvManager.setUseCloudAnalyticsDelayFirst(cloudDelayFlag);
VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager(); VcsConfigManager vcsConfigManager = designerEnvManager.getVcsConfigManager();
vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue()); vcsConfigManager.setSaveInterval(this.saveIntervalEditor.getValue());
vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected()); vcsConfigManager.setVcsEnable(this.vcsEnableCheckBox.isSelected());

14
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -61,6 +61,7 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Box; import javax.swing.Box;
@ -416,10 +417,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
} }
private void checkParameter() { private void checkParameter() {
String[] paramTexts = new String[2]; Parameter[] parameters = getParameters();
paramTexts[0] = this.sqlTextPane.getText();
paramTexts[1] = this.pageQuery;
Parameter[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false);
if (parameters.length < 1 && this.editorPane.update().size() < 1) { if (parameters.length < 1 && this.editorPane.update().size() < 1) {
return; return;
@ -443,6 +441,14 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
refreshParameters(); refreshParameters();
} }
@NotNull
private Parameter[] getParameters() {
String[] paramTexts = new String[2];
paramTexts[0] = SqlUtils.clearSqlComments(this.sqlTextPane.getText());
paramTexts[1] = SqlUtils.clearSqlComments(this.pageQuery);
return ParameterHelper.analyze4Parameters(paramTexts, false);
}
@Override @Override
public void populateBean(DBTableData dbTableData) { public void populateBean(DBTableData dbTableData) {
this.dbTableData = dbTableData; this.dbTableData = dbTableData;

6
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -153,9 +153,9 @@ public class PluginOperateUtils {
public void run() { public void run() {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginContext plugin = PluginManager.getContext(pluginMarker); PluginContext plugin = PluginManager.getContext(pluginMarker);
boolean isRunning = plugin.isRunning(); boolean running = plugin.isRunning() || plugin.isPrepare();
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(isRunning, jsCallback); PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(running, jsCallback);
changePluginActive(isRunning, pluginMarker, modifyStatusCallback, plugin); changePluginActive(running, pluginMarker, modifyStatusCallback, plugin);
} }
}); });
} }

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

@ -270,8 +270,8 @@ public class PluginUtils {
jo.put("vendor", pluginContext.getVendor()); jo.put("vendor", pluginContext.getVendor());
jo.put("price", pluginContext.getPrice()); jo.put("price", pluginContext.getPrice());
jo.put("requiredJarTime", pluginContext.getRequiredJarTime()); jo.put("requiredJarTime", pluginContext.getRequiredJarTime());
// 前端需求的active实际上是插件的运行状态,通过isRunning()获取 // 前端需求的active实际上是插件的运行状态,通过isRunning()或isPrepare()获取
jo.put("active", pluginContext.isRunning()); jo.put("active", pluginContext.isRunning() || pluginContext.isPrepare());
jo.put("hidden", pluginContext.isHidden()); jo.put("hidden", pluginContext.isHidden());
jo.put("free", pluginContext.isFree()); jo.put("free", pluginContext.isFree());
jo.put("licDamaged", pluginContext.isLicDamaged()); jo.put("licDamaged", pluginContext.isLicDamaged());

64
designer-base/src/main/java/com/fr/design/lock/LockFileReSaveEnum.java

@ -0,0 +1,64 @@
package com.fr.design.lock;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.TemplateUtils;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.stable.StableUtils;
import com.fr.stable.project.ProjectConstants;
/**
* 被锁住的文件重新保存副本时的处理枚举类
*
* @author Roger
* @since 11.0
* Created on 2023/12/21
*/
public enum LockFileReSaveEnum {
/**
* 保存目录树里面的模板副本
*/
TEMPLATE_TREE() {
@Override
public void action() {
FileNode node = TemplateTreePane.getInstance().getFileNode();
if (node == null) {
return;
}
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getFilePath());
TemplateUtils.createAndReOpenTemplate(
Toolkit.i18nText("Fine_Design_Template_Lock_Copy"),
new FileNodeFILE(new FileNode(selectedFilePath, false)),
false,
true);
}
},
/**
* 保存设计器里面已经打开的模板副本
*/
HISTORY_TEMPLATE_CACHE() {
@Override
public void action() {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (JTemplate.isValid(template)) {
TemplateUtils.createAndOpenTemplate(
Toolkit.i18nText("Fine_Design_Template_Backup"),
new FileNodeFILE(new FileNode(template.getPath(), false)),
true,
true,
//另存之后需要关闭的模板
template);
}
}
};
/**
* 如何保存模板副本
*/
public abstract void action();
}

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

@ -8,15 +8,14 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.DesignerFrameFileDealerPane; import com.fr.design.mainframe.DesignerFrameFileDealerPane;
import com.fr.design.utils.TemplateUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.project.ProjectConstants;
import com.fr.workspace.base.UserInfo; import com.fr.workspace.base.UserInfo;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.FlowLayout; import java.awt.FlowLayout;
@ -24,9 +23,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
/** /**
* @author hades * @author hades
@ -37,8 +33,11 @@ public class LockInfoDialog extends JDialog {
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm"); private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm");
public LockInfoDialog(UserInfo userInfo) { private final LockFileReSaveEnum saveEnum;
public LockInfoDialog(UserInfo userInfo, LockFileReSaveEnum saveEnum) {
super(DesignerContext.getDesignerFrame()); super(DesignerContext.getDesignerFrame());
this.saveEnum = saveEnum;
JPanel panel = new JPanel(new BorderLayout()); JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); panel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
panel.add(createContentPane(userInfo), BorderLayout.CENTER); panel.add(createContentPane(userInfo), BorderLayout.CENTER);
@ -94,16 +93,7 @@ public class LockInfoDialog extends JDialog {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
dispose(); dispose();
FileNode node = TemplateTreePane.getInstance().getFileNode(); saveEnum.action();
if (node == null) {
return;
}
final String selectedFilePath = StableUtils.pathJoin(ProjectConstants.REPORTLETS_NAME, TemplateTreePane.getInstance().getFilePath());
TemplateUtils.createAndReOpenTemplate(
Toolkit.i18nText("Fine_Design_Template_Lock_Copy"),
new FileNodeFILE(new FileNode(selectedFilePath, false)),
false,
true);
} }
}); });
cancelButton.addActionListener(new ActionListener() { cancelButton.addActionListener(new ActionListener() {
@ -118,9 +108,25 @@ public class LockInfoDialog extends JDialog {
} }
/**
* 显示模板被人锁住了的弹窗信息
*
* @param userInfo 拥有锁的用户信息
*/
public static void show(UserInfo userInfo) { public static void show(UserInfo userInfo) {
DesignerFrameFileDealerPane.getInstance().refreshRightToolBarBy(TemplateTreePane.getInstance().getFileNode()); DesignerFrameFileDealerPane.getInstance().refreshRightToolBarBy(TemplateTreePane.getInstance().getFileNode());
new LockInfoDialog(userInfo); new LockInfoDialog(userInfo, LockFileReSaveEnum.TEMPLATE_TREE);
}
/**
* 显示模板被人锁住了的弹窗信息,并以指定方式保存副本模板
*
* @param userInfo 拥有锁的用户信息
* @param saveEnum 指定保存副本模板的处理方式
*/
public static void show(UserInfo userInfo, LockFileReSaveEnum saveEnum) {
DesignerFrameFileDealerPane.getInstance().refreshRightToolBarBy(TemplateTreePane.getInstance().getFileNode());
new LockInfoDialog(userInfo, saveEnum);
} }
} }

13
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateConfigManager.java

@ -16,6 +16,7 @@ public class DesignerPushUpdateConfigManager implements XMLReadable, XMLWriter {
private boolean autoPushUpdateEnabled = true; // 是否开启自动推送更新 private boolean autoPushUpdateEnabled = true; // 是否开启自动推送更新
private boolean cloudAnalyticsDelay = true; // 是否云端运维模块延迟启动 private boolean cloudAnalyticsDelay = true; // 是否云端运维模块延迟启动
private boolean useCloudAnalyticsDelayFirst = true; // 默认打开,如果有手动改延迟启动配置则按客户配置的来
private String lastIgnoredVersion = StringUtils.EMPTY; // 最近一次跳过的更新版本 private String lastIgnoredVersion = StringUtils.EMPTY; // 最近一次跳过的更新版本
private DesignerPushUpdateConfigManager() { private DesignerPushUpdateConfigManager() {
@ -33,7 +34,8 @@ public class DesignerPushUpdateConfigManager implements XMLReadable, XMLWriter {
if (reader.isAttr()) { if (reader.isAttr()) {
this.setAutoPushUpdateEnabled(reader.getAttrAsBoolean("autoPushUpdateEnabled", true)); this.setAutoPushUpdateEnabled(reader.getAttrAsBoolean("autoPushUpdateEnabled", true));
this.setLastIgnoredVersion(reader.getAttrAsString("lastIgnoredVersion", StringUtils.EMPTY)); this.setLastIgnoredVersion(reader.getAttrAsString("lastIgnoredVersion", StringUtils.EMPTY));
this.setCloudAnalyticsDelay(reader.getAttrAsBoolean("cloudAnalyticsDelay", false)); this.setCloudAnalyticsDelay(reader.getAttrAsBoolean("cloudAnalyticsDelay", true));
this.setUseCloudAnalyticsDelayFirst(reader.getAttrAsBoolean("useCloudAnalyticsDelayFirst", true));
} }
} }
@ -43,6 +45,7 @@ public class DesignerPushUpdateConfigManager implements XMLReadable, XMLWriter {
writer.attr("autoPushUpdateEnabled", autoPushUpdateEnabled); writer.attr("autoPushUpdateEnabled", autoPushUpdateEnabled);
writer.attr("lastIgnoredVersion", lastIgnoredVersion); writer.attr("lastIgnoredVersion", lastIgnoredVersion);
writer.attr("cloudAnalyticsDelay", cloudAnalyticsDelay); writer.attr("cloudAnalyticsDelay", cloudAnalyticsDelay);
writer.attr("useCloudAnalyticsDelayFirst", useCloudAnalyticsDelayFirst);
writer.end(); writer.end();
} }
@ -69,4 +72,12 @@ public class DesignerPushUpdateConfigManager implements XMLReadable, XMLWriter {
public void setCloudAnalyticsDelay(boolean cloudAnalyticsDelay) { public void setCloudAnalyticsDelay(boolean cloudAnalyticsDelay) {
this.cloudAnalyticsDelay = cloudAnalyticsDelay; this.cloudAnalyticsDelay = cloudAnalyticsDelay;
} }
public boolean isUseCloudAnalyticsDelayFirst() {
return useCloudAnalyticsDelayFirst;
}
public void setUseCloudAnalyticsDelayFirst(boolean useCloudAnalyticsDelayFirst) {
this.useCloudAnalyticsDelayFirst = useCloudAnalyticsDelayFirst;
}
} }

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

@ -23,6 +23,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.function.Function; import java.util.function.Function;
@ -65,14 +66,7 @@ public class TemplateUtils {
if (file == null) { if (file == null) {
return; return;
} }
Runnable doAfterCreateTemplate; createAndOpenTemplate0(file, oldPath, createByEditingTemplate, openNewTemplate, null);
//判断一下要保存的文件是否已打开
int index = HistoryTemplateListCache.getInstance().contains(file);
JTemplate template = null;
if (index != -1) {
template = HistoryTemplateListCache.getInstance().getHistoryList().get(index);
}
createAndOpenTemplate0(file, oldPath, createByEditingTemplate, openNewTemplate, template);
} }
/** /**
@ -181,23 +175,29 @@ public class TemplateUtils {
* @param template 需要关闭的模板 * @param template 需要关闭的模板
*/ */
private static void openNewTemplateAndCloseOldTemplate(FILE file, boolean openNewTemplate, @Nullable JTemplate<?, ?> template) { private static void openNewTemplateAndCloseOldTemplate(FILE file, boolean openNewTemplate, @Nullable JTemplate<?, ?> template) {
new SwingWorker<Boolean, Void>() { new SwingWorker<List<JTemplate<?,?>>, Void>() {
@Override @Override
protected Boolean doInBackground() throws Exception { protected List<JTemplate<?,?>> doInBackground() throws Exception {
List<JTemplate<?,?>> needCloseTemplate = new ArrayList<>();
//判断一下要保存的副本文件是否已打开
int index = HistoryTemplateListCache.getInstance().contains(file);
if (index != -1) {
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(file.getPath());
needCloseTemplate.add(HistoryTemplateListCache.getInstance().getHistoryList().get(index));
}
if (JTemplate.isValid(template)) { if (JTemplate.isValid(template)) {
//给要关闭的模板解锁 //给要关闭的模板解锁
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath()); WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath());
return true; needCloseTemplate.add(template);
} }
return false; return needCloseTemplate;
} }
@Override @Override
protected void done() { protected void done() {
try { try {
if (get()) { //获取需要关闭的模板
//模板释放锁成功后关闭该模板 List<JTemplate<?, ?>> jTemplates = get();
HistoryTemplateListCache.getInstance().closeSelectedReport(template); jTemplates.forEach(jTemplate -> HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate));
}
if (openNewTemplate) { if (openNewTemplate) {
DesignerContext.getDesignerFrame().openTemplate(file); DesignerContext.getDesignerFrame().openTemplate(file);
} }

32
designer-base/src/main/java/com/fr/design/worker/save/SaveFailureHandler.java

@ -2,21 +2,17 @@ package com.fr.design.worker.save;
import com.fr.common.exception.ThrowableHandler; import com.fr.common.exception.ThrowableHandler;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.lock.LockFileReSaveEnum;
import com.fr.design.lock.LockInfoDialog; import com.fr.design.lock.LockInfoDialog;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.utils.TemplateUtils;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.report.InconsistentLockException;
import com.fr.report.LockedException; import com.fr.report.LockedException;
import com.fr.report.UnLockedException; import com.fr.report.UnLockedException;
import com.fr.workspace.base.UserInfo; import com.fr.workspace.base.UserInfo;
import com.fr.workspace.exception.DiskSpaceFullException; import com.fr.workspace.exception.DiskSpaceFullException;
import com.fr.report.InconsistentLockException;
import java.awt.Frame; import java.awt.Frame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
@ -104,7 +100,7 @@ public class SaveFailureHandler implements ThrowableHandler {
} }
if (exception != null) { if (exception != null) {
UserInfo userInfo = exception.getUserInfo(); UserInfo userInfo = exception.getUserInfo();
LockInfoDialog.show(userInfo); LockInfoDialog.show(userInfo, LockFileReSaveEnum.HISTORY_TEMPLATE_CACHE);
return true; return true;
} }
return false; return false;
@ -134,16 +130,7 @@ public class SaveFailureHandler implements ThrowableHandler {
IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"), IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"),
new Object[] {Toolkit.i18nText("Fine_Design_Template_SaveAs_Backup"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null); new Object[] {Toolkit.i18nText("Fine_Design_Template_SaveAs_Backup"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null);
if (option == JOptionPane.YES_OPTION) { if (option == JOptionPane.YES_OPTION) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); LockFileReSaveEnum.HISTORY_TEMPLATE_CACHE.action();
if (JTemplate.isValid(template)) {
TemplateUtils.createAndOpenTemplate(
Toolkit.i18nText("Fine_Design_Template_Backup"),
new FileNodeFILE(new FileNode(template.getPath(), false)),
true,
true,
//另存之后需要关闭的模板
template);
}
} }
} }
@ -156,16 +143,7 @@ public class SaveFailureHandler implements ThrowableHandler {
IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"), IOUtils.readIcon("/com/fr/design/images/warnings/warning32.png"),
new Object[] {Toolkit.i18nText("Fine_Design_Template_SaveAs_Backup"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null); new Object[] {Toolkit.i18nText("Fine_Design_Template_SaveAs_Backup"), Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")}, null);
if (option == JOptionPane.YES_OPTION) { if (option == JOptionPane.YES_OPTION) {
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); LockFileReSaveEnum.HISTORY_TEMPLATE_CACHE.action();
if (JTemplate.isValid(template)) {
TemplateUtils.createAndOpenTemplate(
Toolkit.i18nText("Fine_Design_Template_Backup"),
new FileNodeFILE(new FileNode(template.getPath(), false)),
true,
true,
//另存之后需要关闭的模板
template);
}
} }
} }

2
designer-base/src/main/java/com/fr/startup/metric/DesignerStartupModel.java

@ -96,7 +96,7 @@ public class DesignerStartupModel {
} }
private void fillInfo() { private void fillInfo() {
this.setJdkVersion(System.getProperty("java.runtime.version")); this.setJdkVersion(System.getProperty("java.version"));
MachineInfo info = new MachineInfo(); MachineInfo info = new MachineInfo();
AbstractOperatingSystem operatingSystem = OperatingSystem.getOperatingSystem(); AbstractOperatingSystem operatingSystem = OperatingSystem.getOperatingSystem();
info.setSystem(operatingSystem.getDisplayString()); info.setSystem(operatingSystem.getDisplayString());

12
designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/DesktopWidgetStyleEditPane.java

@ -5,12 +5,14 @@ import com.fr.base.theme.TemplateTheme;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.widgettheme.theme.widget.style.BorderStyle; import com.fr.widgettheme.theme.widget.style.BorderStyle;
import com.fr.widgettheme.theme.widget.style.ButtonBackgroundStyle; import com.fr.widgettheme.theme.widget.style.ButtonBackgroundStyle;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle; import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle;
import com.fr.design.gui.ibutton.UIRadioButton; import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import com.fr.widgettheme.util.ThemeTextStylePaneCreator;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -52,7 +54,7 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Style")), stylePane}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Style")), stylePane},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Line")), lineComboBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Line")), lineComboBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Radius")), borderRadiusSpinner}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Radius")), borderRadiusSpinner},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), textStylePane}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), ThemeTextStylePaneCreator.create(fontSizePane, fontColorButton)},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Background_Select_Box")), selectBackgroundColorBox} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Background_Select_Box")), selectBackgroundColorBox}
}; };
} }
@ -86,7 +88,8 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
colorSelectBox.setSelectObject(style.getThemeColor()); colorSelectBox.setSelectObject(style.getThemeColor());
lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType()); lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType());
borderRadiusSpinner.setValue(style.getBorderStyle().getRadius()); borderRadiusSpinner.setValue(style.getBorderStyle().getRadius());
textStylePane.setTextStyle(style.getTextStyle()); fontSizePane.setValue(style.getTextStyle().getFontSize());
fontColorButton.setColor(style.getTextStyle().getFontColor());
selectBackgroundColorBox.setSelectObject(style.getSelectBackgroundColor()); selectBackgroundColorBox.setSelectObject(style.getSelectBackgroundColor());
} }
@ -102,7 +105,10 @@ public class DesktopWidgetStyleEditPane<T extends TemplateTheme> extends WidgetS
borderStyle.setLineType(lineComboBox.getSelectedLineStyle()); borderStyle.setLineType(lineComboBox.getSelectedLineStyle());
borderStyle.setRadius((int) borderRadiusSpinner.getValue()); borderStyle.setRadius((int) borderRadiusSpinner.getValue());
style.setBorderStyle(borderStyle); style.setBorderStyle(borderStyle);
style.setTextStyle(textStylePane.getTextStyle()); ThemeTextStyle textStyle = new ThemeTextStyle();
textStyle.setFontSize(fontSizePane.getValue());
textStyle.setFontColor(fontColorButton.getColor());
style.setTextStyle(textStyle);
ButtonBackgroundStyle buttonBackgroundStyle = new ButtonBackgroundStyle(); ButtonBackgroundStyle buttonBackgroundStyle = new ButtonBackgroundStyle();
ColorBackground buttonBackground = ColorBackground.getInstance(style.getThemeColor()); ColorBackground buttonBackground = ColorBackground.getInstance(style.getThemeColor());
buttonBackgroundStyle.setInitialBackground(buttonBackground); buttonBackgroundStyle.setInitialBackground(buttonBackground);

15
designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/MobileWidgetStyleEditPane.java

@ -1,10 +1,11 @@
package com.fr.widgettheme.theme.edit.widget; package com.fr.widgettheme.theme.edit.widget;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.widgettheme.theme.panel.WidgetTextStylePane; import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.widgettheme.theme.widget.style.BorderStyle; import com.fr.widgettheme.theme.widget.style.BorderStyle;
import com.fr.widgettheme.theme.widget.style.MobileThemedWidgetStyle; import com.fr.widgettheme.theme.widget.style.MobileThemedWidgetStyle;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import java.util.Arrays; import java.util.Arrays;
@ -38,8 +39,8 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
} }
@Override @Override
protected void initTextStylePane() { protected void initFontSizePane() {
textStylePane = new WidgetTextStylePane(FONT_SIZES, 140); fontSizePane = new FontSizeComboPane(FONT_SIZES);
} }
@Override @Override
@ -52,7 +53,8 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
colorSelectBox.setSelectObject(style.getThemeColor()); colorSelectBox.setSelectObject(style.getThemeColor());
lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType()); lineComboBox.setSelectedLineStyle(style.getBorderStyle().getLineType());
borderRadiusSpinner.setValue(style.getBorderStyle().getRadius()); borderRadiusSpinner.setValue(style.getBorderStyle().getRadius());
textStylePane.setTextStyle(style.getTextStyle()); fontSizePane.setValue(style.getTextStyle().getFontSize());
fontColorButton.setColor(style.getTextStyle().getFontColor());
} }
@Override @Override
@ -67,7 +69,10 @@ public class MobileWidgetStyleEditPane<T extends TemplateTheme> extends WidgetSt
borderStyle.setLineType(lineComboBox.getSelectedLineStyle()); borderStyle.setLineType(lineComboBox.getSelectedLineStyle());
borderStyle.setRadius((int) borderRadiusSpinner.getValue()); borderStyle.setRadius((int) borderRadiusSpinner.getValue());
style.setBorderStyle(borderStyle); style.setBorderStyle(borderStyle);
style.setTextStyle(textStylePane.getTextStyle()); ThemeTextStyle textStyle = new ThemeTextStyle();
textStyle.setFontSize(fontSizePane.getValue());
textStyle.setFontColor(fontColorButton.getColor());
style.setTextStyle(textStyle);
} }
} }

18
designer-base/src/main/java/com/fr/widgettheme/theme/edit/widget/WidgetStyleEditPane.java

@ -3,6 +3,8 @@ package com.fr.widgettheme.theme.edit.widget;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.icombobox.LineComboBox; import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
@ -13,8 +15,8 @@ import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.style.color.NewColorSelectBox; import com.fr.design.style.color.NewColorSelectBox;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.widgettheme.theme.panel.WidgetTextStylePane;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import com.fr.widgettheme.util.ThemeTextStylePaneCreator;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -42,7 +44,9 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
/** /**
* 文本样式面板 * 文本样式面板
*/ */
protected WidgetTextStylePane textStylePane; protected FontSizeComboPane fontSizePane;
protected UIColorButton fontColorButton;
public WidgetStyleEditPane() { public WidgetStyleEditPane() {
initComponents(); initComponents();
@ -72,7 +76,7 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Color")), colorSelectBox}, new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Color")), colorSelectBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Line")), lineComboBox}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Line")), lineComboBox},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Radius")), borderRadiusSpinner}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Border_Radius")), borderRadiusSpinner},
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), textStylePane} new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Widget_Theme_Text_Style")), ThemeTextStylePaneCreator.create(fontSizePane, fontColorButton)}
}; };
} }
@ -81,12 +85,12 @@ public class WidgetStyleEditPane<T extends TemplateTheme> extends BasicBeanPane<
colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR); colorSelectBox.setSelectObject(WidgetThemeDisplayConstants.DEFAULT_THEME_COLOR);
initLineBox(); initLineBox();
borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1);
initTextStylePane(); initFontSizePane();
textStylePane.setFontSizeValue(16); fontColorButton = new UIColorButton();
} }
protected void initTextStylePane() { protected void initFontSizePane() {
textStylePane = new WidgetTextStylePane(FRFontPane.getFontSizes(), WidgetThemeDisplayConstants.THEME_WIDGET_COMPONENT_WIDTH); fontSizePane = new FontSizeComboPane(FRFontPane.getFontSizes());
} }
/** /**

70
designer-base/src/main/java/com/fr/widgettheme/theme/panel/WidgetTextStylePane.java

@ -1,70 +0,0 @@
package com.fr.widgettheme.theme.panel;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.util.Vector;
/**
* 控件文本样式配置面板
* 包含文本字体大小和字体颜色
*
* @author oBo
* @since 11.0
* Created on 2023/12/13
*/
public class WidgetTextStylePane extends JPanel {
private final FontSizeComboPane fontSizePane;
private final UIColorButton fontColorButton;
public WidgetTextStylePane(int preferredWidth) {
this(null, preferredWidth);
}
public WidgetTextStylePane(Vector<Integer> fontSizes, int preferredWidth) {
this.setLayout(new FlowLayout(FlowLayout.LEFT));
this.setBorder(BorderFactory.createEmptyBorder());
fontSizePane = new FontSizeComboPane(fontSizes);
fontColorButton = new UIColorButton();
fontSizePane.setPreferredSize(new Dimension(preferredWidth, fontSizePane.getPreferredSize().height));
this.add(fontSizePane);
this.add(fontColorButton);
}
public void setTextStyle(ThemeTextStyle themeTextStyle) {
this.fontSizePane.setValue(themeTextStyle.getFontSize());
this.fontColorButton.setColor(themeTextStyle.getFontColor());
}
public ThemeTextStyle getTextStyle() {
ThemeTextStyle themeTextStyle = new ThemeTextStyle();
themeTextStyle.setFontSize(this.fontSizePane.getValue());
themeTextStyle.setFontColor(this.fontColorButton.getColor());
return themeTextStyle;
}
public void setFontSizeValue(int fontSize) {
this.fontSizePane.setValue(fontSize);
}
public void setFontColorValue(Color fontColor) {
this.fontColorButton.setColor(fontColor);
}
public int getFontSizeValue() {
return this.fontSizePane.getValue();
}
public Color getFontColorValue() {
return this.fontColorButton.getColor();
}
}

40
designer-base/src/main/java/com/fr/widgettheme/util/ThemeTextStylePaneCreator.java

@ -0,0 +1,40 @@
package com.fr.widgettheme.util;
import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import javax.swing.Box;
import javax.swing.JPanel;
import java.awt.Component;
/**
* 创建主题文本样式的工具类
*
* @author obo
* @since 11.0
* Created on 2023/12/21
*/
public class ThemeTextStylePaneCreator {
private ThemeTextStylePaneCreator() {}
/**
* 创建主题文本样式配置面板
* 包含字体大小下拉框和字体颜色按钮
* 可以自适应布局
*
* @param fontSizePane 字体大小配置
* @param fontColorButton 字体颜色配置
* @return 文本样式面板
*/
public static JPanel create(FontSizeComboPane fontSizePane, UIColorButton fontColorButton) {
Component[][] components = {{fontSizePane, Box.createHorizontalStrut(5), fontColorButton}};
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {f};
double[] columnSize = {f, p, p};
int[][] rowCount = {{1, 1, 1}};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 0, 0);
}
}

41
designer-base/src/test/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPaneTest.java

@ -0,0 +1,41 @@
package com.fr.design.data.tabledata.tabledatapane;
import com.fr.base.Parameter;
import com.fr.design.data.datapane.sqlpane.SQLEditPane;
import com.fr.invoke.Reflect;
import junit.framework.TestCase;
import org.junit.Assert;
/**
* @author Yuan.Wang
* @since 11.0
* Created on 2023/12/22
*/
public class DBTableDataPaneTest extends TestCase {
public void testGetParameters() {
DBTableDataPane pane = new DBTableDataPane();
SQLEditPane editPane = new SQLEditPane();
String sql = "select distinct 类别ID from S产品\n" +
"where 1=1\n" +
"order by 类别ID\n" +
"--${ if(len(comboBox0) = 0,\"\",\"AND 类别00ID = '\" + comboBox0 + \"'\")}";
String sql1 = "select distinct 类别ID from S产品\n" +
"where 1=1\n" +
"order by 类别ID\n" +
"${ if(len(comboBox0) = 0,\"\",\"AND 类别00ID = '\" + comboBox0 + \"'\")}";
editPane.setText(sql);
Reflect.on(pane).set("sqlTextPane", editPane);
Reflect.on(pane).set("pageQuery", sql);
Parameter[] parameters = Reflect.on(pane).call("getParameters").get();
Assert.assertEquals(0, parameters.length);
editPane.setText(sql1);
parameters = Reflect.on(pane).call("getParameters").get();
Assert.assertEquals(1, parameters.length);
Assert.assertEquals(parameters[0].getName(), "comboBox0");
}
}

41
designer-form/src/main/java/com/fr/design/widgettheme/BaseStyleSettingPane.java

@ -1,7 +1,8 @@
package com.fr.design.widgettheme; package com.fr.design.widgettheme;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.widgettheme.theme.panel.WidgetTextStylePane; import com.fr.design.gui.frpane.FontSizeComboPane;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.widgettheme.theme.widget.style.BorderStyle; import com.fr.widgettheme.theme.widget.style.BorderStyle;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle; import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle; import com.fr.widgettheme.theme.widget.style.ThemedWidgetStyle;
@ -25,11 +26,13 @@ import com.fr.form.ui.Widget;
import com.fr.general.FRFont; import com.fr.general.FRFont;
import com.fr.widgettheme.theme.panel.ButtonStyleDefinedPane; import com.fr.widgettheme.theme.panel.ButtonStyleDefinedPane;
import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants; import com.fr.widgettheme.theme.widget.theme.WidgetThemeDisplayConstants;
import com.fr.widgettheme.util.ThemeTextStylePaneCreator;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ButtonGroup; import javax.swing.ButtonGroup;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -63,12 +66,18 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
protected FRFontPane frFontPane; protected FRFontPane frFontPane;
// 按钮背景设置 // 按钮背景设置
protected ButtonStyleDefinedPane buttonStyleDefinedPane; protected ButtonStyleDefinedPane buttonStyleDefinedPane;
protected NewColorSelectBox selectBgColorBox;
/** /**
* 文本样式 * 主题文本样式的字体大小
* 包含字体大小字体颜色
*/ */
protected WidgetTextStylePane textStylePane; protected FontSizeComboPane fontSizePane;
protected NewColorSelectBox selectBgColorBox;
/**
* 主题文本样式的字体颜色
*/
protected UIColorButton fontColorButton;
private final Map<StyleSetting, UILabel> labelMap = new HashMap<>(); private final Map<StyleSetting, UILabel> labelMap = new HashMap<>();
private final Map<StyleSetting, Component> paneMap = new HashMap<>(); private final Map<StyleSetting, Component> paneMap = new HashMap<>();
@ -94,12 +103,13 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
borderRadiusSpinner = new UIBoundSpinner(0, Integer.MAX_VALUE, 1); borderRadiusSpinner = new UIBoundSpinner(0, Integer.MAX_VALUE, 1);
frFontPane = new FRFontPane(); frFontPane = new FRFontPane();
buttonStyleDefinedPane = new ButtonStyleDefinedPane(); buttonStyleDefinedPane = new ButtonStyleDefinedPane();
textStylePane = new WidgetTextStylePane(100);
selectBgColorBox = new NewColorSelectBox(160, true); selectBgColorBox = new NewColorSelectBox(160, true);
fontSizePane = new FontSizeComboPane();
fontColorButton = new UIColorButton();
paneMap.put(StyleSetting.STYLE_TYPE, createStyleTypePane()); paneMap.put(StyleSetting.STYLE_TYPE, createStyleTypePane());
paneMap.put(StyleSetting.THEME_COLOR, colorSelectBox); paneMap.put(StyleSetting.THEME_COLOR, colorSelectBox);
paneMap.put(StyleSetting.LINE_TYPE, lineComboBox); paneMap.put(StyleSetting.LINE_TYPE, lineComboBox);
paneMap.put(StyleSetting.TEXT_STYLE, textStylePane); paneMap.put(StyleSetting.TEXT_STYLE, ThemeTextStylePaneCreator.create(fontSizePane, fontColorButton));
paneMap.put(StyleSetting.BORDER_RADIUS, borderRadiusSpinner); paneMap.put(StyleSetting.BORDER_RADIUS, borderRadiusSpinner);
paneMap.put(StyleSetting.FONT, frFontPane); paneMap.put(StyleSetting.FONT, frFontPane);
paneMap.put(StyleSetting.BTN_BACKGROUND, buttonStyleDefinedPane); paneMap.put(StyleSetting.BTN_BACKGROUND, buttonStyleDefinedPane);
@ -207,7 +217,7 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
setLineComboBox(widgetStyle); setLineComboBox(widgetStyle);
setBorderRadiusSpinner(widgetStyle); setBorderRadiusSpinner(widgetStyle);
setTextStylePane(widgetStyle); setTextStylePane(widgetStyle);
setFrFontPane(); setFrFontPane(widgetStyle);
setButtonStyleDefinedPane(widgetStyle); setButtonStyleDefinedPane(widgetStyle);
setSelectBgColor(widgetStyle); setSelectBgColor(widgetStyle);
} }
@ -242,12 +252,14 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
} }
private void setTextStylePane(ThemedWidgetStyle widgetStyle) { private void setTextStylePane(ThemedWidgetStyle widgetStyle) {
this.textStylePane.setTextStyle(widgetStyle.getTextStyle()); ThemeTextStyle textStyle = widgetStyle.getTextStyle();
this.fontSizePane.setValue(textStyle.getFontSize());
this.fontColorButton.setColor(textStyle.getFontColor());
} }
private void setFrFontPane() { private void setFrFontPane(ThemedWidgetStyle widgetStyle) {
if (frFontPane != null) { if (frFontPane != null) {
frFontPane.populateBean(FRFont.getInstance()); frFontPane.populateBean(widgetStyle.getFontStyle().getFont());
} }
} }
@ -269,8 +281,11 @@ public abstract class BaseStyleSettingPane<T extends Widget> extends BasicBeanPa
if (borderRadiusSpinner != null) { if (borderRadiusSpinner != null) {
borderRadiusSpinner.setValue(BorderStyle.DEFAULT_BORDER_RADIUS); borderRadiusSpinner.setValue(BorderStyle.DEFAULT_BORDER_RADIUS);
} }
if (textStylePane != null) { if (fontSizePane != null) {
textStylePane.setTextStyle(new ThemeTextStyle()); fontSizePane.setValue(ThemeTextStyle.DEFAULT_FONT_SIZE);
}
if (fontColorButton != null) {
fontColorButton.setColor(Color.BLACK);
} }
if (frFontPane != null) { if (frFontPane != null) {
frFontPane.populateBean(FRFont.getInstance()); frFontPane.populateBean(FRFont.getInstance());

5
designer-form/src/main/java/com/fr/design/widgettheme/LabelSettingPane.java

@ -38,6 +38,11 @@ public class LabelSettingPane<T extends Widget> extends BaseStyleSettingPane<T>
LabelTheme widgetTheme = (LabelTheme) t.getWidgetTheme(); LabelTheme widgetTheme = (LabelTheme) t.getWidgetTheme();
if (widgetTheme == null) { if (widgetTheme == null) {
widgetTheme = new LabelTheme(); widgetTheme = new LabelTheme();
Label label = (Label) t;
if (!label.getDefaultFont().equals(label.getFont())) {
widgetTheme.setFollowTheme(false);
widgetTheme.setFontStyle(new FontStyle((label.getFont())));
}
t.setWidgetTheme(widgetTheme); t.setWidgetTheme(widgetTheme);
} }
return widgetTheme; return widgetTheme;

11
designer-form/src/main/java/com/fr/design/widgettheme/ParaButtonSettingPane.java

@ -2,6 +2,7 @@ package com.fr.design.widgettheme;
import com.fr.design.widgettheme.common.ButtonSettingPane; import com.fr.design.widgettheme.common.ButtonSettingPane;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
import com.fr.widgettheme.theme.widget.theme.ParaButtonTheme; import com.fr.widgettheme.theme.widget.theme.ParaButtonTheme;
import com.fr.widgettheme.theme.widget.theme.cell.ButtonTheme; import com.fr.widgettheme.theme.widget.theme.cell.ButtonTheme;
@ -32,14 +33,18 @@ public class ParaButtonSettingPane<T extends Widget> extends ButtonSettingPane<T
@Override @Override
protected void assignFontSizePane(ButtonTheme buttonTheme) { protected void assignFontSizePane(ButtonTheme buttonTheme) {
ParaButtonTheme paraButtonTheme = (ParaButtonTheme) buttonTheme; ThemeTextStyle textStyle = ((ParaButtonTheme) buttonTheme).getTextStyle();
textStylePane.setTextStyle(paraButtonTheme.getTextStyle()); fontSizePane.setValue(textStyle.getFontSize());
fontColorButton.setColor(textStyle.getFontColor());
} }
@Override @Override
protected void assignFontSizeStyle(ButtonTheme buttonTheme) { protected void assignFontSizeStyle(ButtonTheme buttonTheme) {
ParaButtonTheme paraButtonTheme = (ParaButtonTheme) buttonTheme; ParaButtonTheme paraButtonTheme = (ParaButtonTheme) buttonTheme;
paraButtonTheme.setTextStyle(textStylePane.getTextStyle()); ThemeTextStyle textStyle = new ThemeTextStyle();
textStyle.setFontSize(fontSizePane.getValue());
textStyle.setFontColor(fontColorButton.getColor());
paraButtonTheme.setTextStyle(textStyle);
} }
} }

11
designer-form/src/main/java/com/fr/design/widgettheme/ParaEditorSettingPane.java

@ -2,6 +2,7 @@ package com.fr.design.widgettheme;
import com.fr.design.widgettheme.common.EditorSettingPane; import com.fr.design.widgettheme.common.EditorSettingPane;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
import com.fr.widgettheme.theme.widget.theme.ParaEditorTheme; import com.fr.widgettheme.theme.widget.theme.ParaEditorTheme;
import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme; import com.fr.widgettheme.theme.widget.theme.cell.EditorTheme;
@ -35,14 +36,18 @@ public class ParaEditorSettingPane<T extends Widget> extends EditorSettingPane<T
@Override @Override
protected void assignFontSizePane(EditorTheme widgetTheme) { protected void assignFontSizePane(EditorTheme widgetTheme) {
ParaEditorTheme paraEditorTheme= (ParaEditorTheme) widgetTheme; ThemeTextStyle textStyle = ((ParaEditorTheme) widgetTheme).getTextStyle();
textStylePane.setTextStyle(paraEditorTheme.getTextStyle()); fontSizePane.setValue(textStyle.getFontSize());
fontColorButton.setColor(textStyle.getFontColor());
} }
@Override @Override
protected void assignFontSizeStyle(EditorTheme widgetTheme) { protected void assignFontSizeStyle(EditorTheme widgetTheme) {
ParaEditorTheme paraEditorTheme= (ParaEditorTheme) widgetTheme; ParaEditorTheme paraEditorTheme= (ParaEditorTheme) widgetTheme;
paraEditorTheme.setTextStyle(textStylePane.getTextStyle()); ThemeTextStyle textStyle = new ThemeTextStyle();
textStyle.setFontSize(fontSizePane.getValue());
textStyle.setFontColor(fontColorButton.getColor());
paraEditorTheme.setTextStyle(textStyle);
} }
@Override @Override

12
designer-form/src/main/java/com/fr/design/widgettheme/ParaTreeEditorSettingPane.java

@ -2,6 +2,7 @@ package com.fr.design.widgettheme;
import com.fr.design.widgettheme.common.TreeEditorSettingPane; import com.fr.design.widgettheme.common.TreeEditorSettingPane;
import com.fr.form.ui.TreeEditor; import com.fr.form.ui.TreeEditor;
import com.fr.widgettheme.theme.widget.style.ThemeTextStyle;
import com.fr.widgettheme.theme.widget.theme.ParaTreeTheme; import com.fr.widgettheme.theme.widget.theme.ParaTreeTheme;
import com.fr.widgettheme.theme.widget.theme.cell.TreeTheme; import com.fr.widgettheme.theme.widget.theme.cell.TreeTheme;
@ -32,13 +33,16 @@ public class ParaTreeEditorSettingPane<T extends TreeEditor> extends TreeEditorS
@Override @Override
protected void assignFontSizePane(TreeTheme widgetTheme) { protected void assignFontSizePane(TreeTheme widgetTheme) {
ParaTreeTheme paraTreeTheme= (ParaTreeTheme) widgetTheme; ThemeTextStyle textStyle = widgetTheme.getTextStyle();
textStylePane.setTextStyle(paraTreeTheme.getTextStyle()); fontSizePane.setValue(textStyle.getFontSize());
fontColorButton.setColor(textStyle.getFontColor());
} }
@Override @Override
protected void assignFontSizeStyle(TreeTheme widgetTheme) { protected void assignFontSizeStyle(TreeTheme widgetTheme) {
ParaTreeTheme paraTreeTheme= (ParaTreeTheme) widgetTheme; ThemeTextStyle textStyle = new ThemeTextStyle();
paraTreeTheme.setTextStyle(textStylePane.getTextStyle()); textStyle.setFontSize(fontSizePane.getValue());
textStyle.setFontColor(fontColorButton.getColor());
widgetTheme.setTextStyle(textStyle);
} }
} }

11
designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java

@ -30,6 +30,7 @@ import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.IconDefinePane; import com.fr.design.widget.IconDefinePane;
import com.fr.form.ui.Button; import com.fr.form.ui.Button;
import com.fr.form.ui.CustomToolBarButton; import com.fr.form.ui.CustomToolBarButton;
import com.fr.general.ColorMode;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.Background; import com.fr.general.Background;
@ -182,7 +183,7 @@ public class EditToolBar extends BasicPane {
if(WidgetThemeDesignerUtils.enableWidgetEnhance()) { if(WidgetThemeDesignerUtils.enableWidgetEnhance()) {
backgroundPane.add(createButtonColorGroup()); backgroundPane.add(createButtonColorGroup());
} }
backgroundPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set_Background"))); backgroundPane.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_ToolBar_Style_Setting")));
this.add(backgroundPane, BorderLayout.SOUTH); this.add(backgroundPane, BorderLayout.SOUTH);
} }
@ -227,7 +228,7 @@ public class EditToolBar extends BasicPane {
this.defaultCheckBox.setSelected(ftoolbar.isDefault() ? true : false); this.defaultCheckBox.setSelected(ftoolbar.isDefault() ? true : false);
if (bgColorButtonGroup != null) { if (bgColorButtonGroup != null) {
this.bgColorButtonGroup.setSelectedIndex(ftoolbar.isBgColorLight() ? 0 : 1); this.bgColorButtonGroup.setSelectedIndex(ftoolbar.getButtonBgColorMode().getCode());
} }
} }
@ -263,7 +264,7 @@ public class EditToolBar extends BasicPane {
ftoolBar.setBackground(this.background); ftoolBar.setBackground(this.background);
} }
if (bgColorButtonGroup != null) { if (bgColorButtonGroup != null) {
ftoolBar.setBgColorLight(bgColorButtonGroup.getSelectedIndex() == 0); ftoolBar.setButtonBgColorMode(ColorMode.getModeByCode(bgColorButtonGroup.getSelectedIndex()));
} }
return ftoolBar; return ftoolBar;
} }
@ -729,7 +730,9 @@ public class EditToolBar extends BasicPane {
private JPanel createButtonColorGroup() { private JPanel createButtonColorGroup() {
UILabel headLabel = new UILabel(Toolkit.i18nText("Fine-Design_ToolBar_Button_Color")); UILabel headLabel = new UILabel(Toolkit.i18nText("Fine-Design_ToolBar_Button_Color"));
String[] titles = new String[]{Toolkit.i18nText("Fine-Design_ToolBar_Button_Color_Light"), Toolkit.i18nText("Fine-Design_ToolBar_Button_Color_Dark")}; String[] titles = new String[]{ Toolkit.i18nText("Fine-Design_ToolBar_Button_Color_Auto"),
Toolkit.i18nText("Fine-Design_ToolBar_Button_Color_Light"),
Toolkit.i18nText("Fine-Design_ToolBar_Button_Color_Dark")};
bgColorButtonGroup = new UIButtonGroup<String>(titles) { bgColorButtonGroup = new UIButtonGroup<String>(titles) {
@Override @Override
public void setSelectedIndex(int newSelectedIndex, boolean fireChanged) { public void setSelectedIndex(int newSelectedIndex, boolean fireChanged) {

13
designer-realize/src/main/java/com/fr/design/webattr/FToolBar.java

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.fr.form.ui.ToolBar; import com.fr.form.ui.ToolBar;
import com.fr.general.ColorMode;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Background; import com.fr.general.Background;
@ -12,7 +13,7 @@ public class FToolBar {
private Background background = null; private Background background = null;
private boolean isDefault = true; private boolean isDefault = true;
private boolean buttonBgColorLight = true; private ColorMode buttonBgColorMode = ColorMode.AUTO;
public List<ToolBarButton> getButtonlist() { public List<ToolBarButton> getButtonlist() {
return buttonlist; return buttonlist;
} }
@ -53,12 +54,12 @@ public class FToolBar {
this.isDefault = isDefault; this.isDefault = isDefault;
} }
public boolean isBgColorLight() { public ColorMode getButtonBgColorMode() {
return buttonBgColorLight; return buttonBgColorMode;
} }
public void setBgColorLight(boolean bgColorLight) { public void setButtonBgColorMode(ColorMode buttonBgColorMode) {
this.buttonBgColorLight = bgColorLight; this.buttonBgColorMode = buttonBgColorMode;
} }
public ToolBar getToolBar() { public ToolBar getToolBar() {
@ -69,7 +70,7 @@ public class FToolBar {
ToolBar toolBar = new ToolBar(n); ToolBar toolBar = new ToolBar(n);
toolBar.setBackground(this.background); toolBar.setBackground(this.background);
toolBar.setDefault(this.isDefault); toolBar.setDefault(this.isDefault);
toolBar.setButtonBgColorLight(this.buttonBgColorLight); toolBar.setButtonBgColorMode(this.buttonBgColorMode);
return toolBar; return toolBar;
} }
} }

2
designer-realize/src/main/java/com/fr/design/webattr/ToolBarPane.java

@ -157,7 +157,7 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
} }
this.getFToolBar().setBackground(toolbar.getBackground()); this.getFToolBar().setBackground(toolbar.getBackground());
this.getFToolBar().setDefault(toolbar.isDefault()); this.getFToolBar().setDefault(toolbar.isDefault());
this.getFToolBar().setBgColorLight(toolbar.isButtonBgColorLight()); this.getFToolBar().setButtonBgColorMode(toolbar.getButtonBgColorMode());
setPopulateFinished(true); setPopulateFinished(true);
} }

8
designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java

@ -11,6 +11,7 @@ import com.fr.event.Event;
import com.fr.event.Listener; import com.fr.event.Listener;
import com.fr.event.Null; import com.fr.event.Null;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.process.FineProcess; import com.fr.process.FineProcess;
import com.fr.process.ProcessEventPipe; import com.fr.process.ProcessEventPipe;
import com.fr.process.engine.core.FineProcessContext; import com.fr.process.engine.core.FineProcessContext;
@ -37,7 +38,7 @@ public class DesignerSuperListener {
private final ScheduledExecutorService service = Executors.newScheduledThreadPool(2, new NamedThreadFactory("DesignerListener")); private final ScheduledExecutorService service = Executors.newScheduledThreadPool(2, new NamedThreadFactory("DesignerListener"));
private final ExecutorService helpService = Executors.newSingleThreadExecutor( new NamedThreadFactory("DesignerSuperListener-Help")); private final ExecutorService helpService = Executors.newSingleThreadExecutor( new NamedThreadFactory("DesignerSuperListener-Help"));
private final ScheduledExecutorService EXIT_SERVICE = Executors.newSingleThreadScheduledExecutor( new NamedThreadFactory("DesignerSuperListener-Exit"));
private FineProcess process; private FineProcess process;
private ScheduledFuture fixedFuture; private ScheduledFuture fixedFuture;
private ScheduledFuture onceFuture; private ScheduledFuture onceFuture;
@ -141,6 +142,11 @@ public class DesignerSuperListener {
} }
private void fallBackReport() { private void fallBackReport() {
// 60S都没退出去就强制关闭
EXIT_SERVICE.schedule(() -> {
FineLoggerFactory.getLogger().error("[DesignerSuperListener] The designer failed to exit gracefully, attempting a forced shutdown.");
System.exit(1);
}, 60, TimeUnit.SECONDS);
DesignUtils.initLookAndFeel(); DesignUtils.initLookAndFeel();
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getId(), StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getId(),
DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getMessage(), DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getMessage(),

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

@ -554,7 +554,6 @@ public class DesignerActivator extends Activator implements Prepare {
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() { EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@Override @Override
public void on(Event event, Null param) { public void on(Event event, Null param) {
FineLoggerFactory.reset();
new SwingWorker<Void, Void>() { new SwingWorker<Void, Void>() {
@Override @Override

2
designer-realize/src/main/java/com/fr/strongest/WidgetThemeListenerStarter.java

@ -53,7 +53,7 @@ public class WidgetThemeListenerStarter {
BaseBook workBook = (BaseBook) temp.getTarget(); BaseBook workBook = (BaseBook) temp.getTarget();
if (isNeedAddAttr(temp, workBook)) { if (isNeedAddAttr(temp, workBook)) {
WidgetDisplayEnhanceMarkAttr attr = new WidgetDisplayEnhanceMarkAttr(); WidgetDisplayEnhanceMarkAttr attr = new WidgetDisplayEnhanceMarkAttr();
attr.setWidgetEnhance(true); attr.setWidgetEnhance(false);
workBook.addAttrMark(attr); workBook.addAttrMark(attr);
} }
} }

Loading…
Cancel
Save