Starryi
3 years ago
5 changed files with 49 additions and 4 deletions
@ -0,0 +1,41 @@
|
||||
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.FloatElement; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/9/9 |
||||
*/ |
||||
public class DefaultThemedFloatElement { |
||||
public static FloatElement createInstance() { |
||||
return themingFloatElement(new FloatElement()); |
||||
} |
||||
|
||||
public static FloatElement createInstance(Object value) { |
||||
return themingFloatElement(new FloatElement(value)); |
||||
} |
||||
|
||||
public static FloatElement createInstance(UNIT leftDistance, UNIT topDistance, UNIT width, UNIT height, Object value) { |
||||
return themingFloatElement(new FloatElement(leftDistance, topDistance, width, height, value)); |
||||
} |
||||
|
||||
private static FloatElement themingFloatElement(FloatElement floatElement) { |
||||
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
if (template != null) { |
||||
TemplateTheme theme = template.getTemplateTheme(); |
||||
ThemedCellStyle themedCellStyle = theme.getCellStyleList().getUse4Default(); |
||||
if (themedCellStyle != null) { |
||||
NameStyle nameStyle = NameStyle.getPassiveInstance(themedCellStyle.getName(), themedCellStyle.getStyle()); |
||||
floatElement.setStyle(nameStyle); |
||||
} |
||||
} |
||||
return floatElement; |
||||
} |
||||
} |
Loading…
Reference in new issue