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 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);
} }

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;

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(),

Loading…
Cancel
Save