Browse Source
【问题原因】 所有设计器层面交互创建新单元格/浮动元素的场景,新创建的单元格使用当前模版主题 的"默认"样式进行初始化,包括且不限于如下场景: 1. 复制粘贴 2. 新增行列 3. 选中空单元格后输入文本 4. 格式刷 【改动思路】 同上fix-lag
Starryi
3 years ago
30 changed files with 118 additions and 79 deletions
@ -0,0 +1,45 @@
|
||||
package com.fr.design.mainframe.theme.utils; |
||||
|
||||
import com.fr.base.NameStyle; |
||||
import com.fr.base.theme.TemplateTheme; |
||||
import com.fr.base.theme.settings.ThemedCellStyle; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.report.cell.DefaultTemplateCellElement; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/8/31 |
||||
*/ |
||||
public class DefaultThemedTemplateCellElementCase { |
||||
|
||||
public static DefaultTemplateCellElement createInstance() { |
||||
return themingCellElement(new DefaultTemplateCellElement()); |
||||
} |
||||
|
||||
public static DefaultTemplateCellElement createInstance(int column, int row) { |
||||
return themingCellElement(new DefaultTemplateCellElement(column, row)); |
||||
} |
||||
|
||||
public static DefaultTemplateCellElement createInstance(int column, int row, Object value) { |
||||
return themingCellElement(new DefaultTemplateCellElement(column, row, value)); |
||||
} |
||||
|
||||
public static DefaultTemplateCellElement createInstance(int column, int row, int columnSpan, int rowSpan, Object value) { |
||||
return themingCellElement(new DefaultTemplateCellElement(column, row, columnSpan, rowSpan, value)); |
||||
} |
||||
|
||||
private static DefaultTemplateCellElement themingCellElement(DefaultTemplateCellElement cellElement) { |
||||
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
if (template != null) { |
||||
TemplateTheme theme = template.getTemplateTheme(); |
||||
ThemedCellStyle themedCellStyle = theme.getCellStyleList().getDefaultCellStyle4New(); |
||||
if (themedCellStyle != null) { |
||||
NameStyle nameStyle = NameStyle.getPassiveInstance(themedCellStyle.getName(), themedCellStyle.getStyle()); |
||||
cellElement.setStyle(nameStyle); |
||||
} |
||||
} |
||||
return cellElement; |
||||
} |
||||
} |
Loading…
Reference in new issue