Browse Source

Merge pull request #13391 in DESIGN/design from release/11.0 to bugfix/11.0

* commit '1a106194c39e93a6bc3f1f9c670153367cac9bde':
  改下实现
  REPORT-92893 锁定的模板,重复另存副本,设计器页面模板内容不更新
  REPORT-109129 偶现设计器关闭后进程残留 添加日志
  REPORT-109129 偶现设计器关闭后进程残留
  REPORT-111549 标签控件设置的字体背景样式等,开启控件增强,之前设置的样式丢了
bugfix/11.0
superman 11 months ago
parent
commit
8a20802167
  1. 32
      designer-base/src/main/java/com/fr/design/utils/TemplateUtils.java
  2. 5
      designer-form/src/main/java/com/fr/design/widgettheme/LabelSettingPane.java
  3. 8
      designer-realize/src/main/java/com/fr/start/DesignerSuperListener.java

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 java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
@ -65,14 +66,7 @@ public class TemplateUtils {
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);
createAndOpenTemplate0(file, oldPath, createByEditingTemplate, openNewTemplate, null);
}
/**
@ -181,23 +175,29 @@ public class TemplateUtils {
* @param template 需要关闭的模板
*/
private static void openNewTemplateAndCloseOldTemplate(FILE file, boolean openNewTemplate, @Nullable JTemplate<?, ?> template) {
new SwingWorker<Boolean, Void>() {
new SwingWorker<List<JTemplate<?,?>>, Void>() {
@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)) {
//给要关闭的模板解锁
WorkContext.getCurrent().get(TplOperator.class).closeAndFreeFile(template.getPath());
return true;
needCloseTemplate.add(template);
}
return false;
return needCloseTemplate;
}
@Override
protected void done() {
try {
if (get()) {
//模板释放锁成功后关闭该模板
HistoryTemplateListCache.getInstance().closeSelectedReport(template);
}
//获取需要关闭的模板
List<JTemplate<?, ?>> jTemplates = get();
jTemplates.forEach(jTemplate -> HistoryTemplateListCache.getInstance().closeSelectedReport(jTemplate));
if (openNewTemplate) {
DesignerContext.getDesignerFrame().openTemplate(file);
}

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();
if (widgetTheme == null) {
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);
}
return widgetTheme;

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.Null;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.process.FineProcess;
import com.fr.process.ProcessEventPipe;
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 ExecutorService helpService = Executors.newSingleThreadExecutor( new NamedThreadFactory("DesignerSuperListener-Help"));
private final ScheduledExecutorService EXIT_SERVICE = Executors.newSingleThreadScheduledExecutor( new NamedThreadFactory("DesignerSuperListener-Exit"));
private FineProcess process;
private ScheduledFuture fixedFuture;
private ScheduledFuture onceFuture;
@ -141,6 +142,11 @@ public class DesignerSuperListener {
}
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();
StartErrorMessageCollector.getInstance().record(DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getId(),
DesignerErrorMessage.UNEXCEPTED_FALL_BACK.getMessage(),

Loading…
Cancel
Save