Browse Source

Merge pull request #10053 in DESIGN/design from bugfix/11.0 to feature/x

* commit 'b9335bc4f166c9624579aff11a91f76b047f8060':
  REPORT-79934 新建模板的A0单元格样式与模板主题的默认单元格样式不一致
feature/x
superman 2 years ago
parent
commit
20c8d359a1
  1. 10
      designer-base/src/main/java/com/fr/design/file/HistoryTemplateListCache.java
  2. 1
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  3. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java

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

@ -41,6 +41,8 @@ public class HistoryTemplateListCache implements CallbackEvent {
private List<JTemplate<?, ?>> historyList;
private JTemplate<?, ?> editingTemplate;
private JTemplate<?, ?> openingOrEditingTemplate;
public static HistoryTemplateListCache getInstance() {
return Holder.INSTANCE;
}
@ -99,6 +101,13 @@ public class HistoryTemplateListCache implements CallbackEvent {
}
}
public void setCurrentOpeningTemplate(JTemplate<?, ?> jt) {
this.openingOrEditingTemplate = jt;
}
public JTemplate<?, ?> getCurrentOpeningOrEditingTemplate() {
return openingOrEditingTemplate;
}
/**
* 需要使用 {@link JTemplate#isValid(JTemplate)} 来判断空
@ -116,6 +125,7 @@ public class HistoryTemplateListCache implements CallbackEvent {
*/
public void setCurrentEditingTemplate(JTemplate<?, ?> jt) {
this.editingTemplate = jt;
this.openingOrEditingTemplate = jt;
if (!JTemplate.isValid(jt)) {
return;

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

@ -190,6 +190,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
public JTemplate(T t, FILE file, boolean isNewFile, Parameter[] parameters) {
super(t);
HistoryTemplateListCache.getInstance().setCurrentOpeningTemplate(this);
if (isNewFile) {
// REPORT-58486: 必须在初始的UndoState创建前设置主题,使得初始的UndoState就包含了主题效果
setUpTheme4NewTemplate();

2
designer-base/src/main/java/com/fr/design/mainframe/theme/utils/DefaultThemedTemplateCellElementCase.java

@ -32,7 +32,7 @@ public class DefaultThemedTemplateCellElementCase {
}
private static DefaultTemplateCellElement themingCellElement(DefaultTemplateCellElement cellElement) {
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentOpeningOrEditingTemplate();
if (JTemplate.isValid(template)) {
TemplateTheme theme = template.getTemplateTheme();
ThemedCellStyle themedCellStyle = theme.getCellStyleList().getUse4Default();

Loading…
Cancel
Save