Browse Source
* commit '43569693e453a53c8a0f033d43f24cbd28791457': REPORT-74887 新建决策报表,拖入第三方插件图表无法编辑 无JIRA任务 合final REPORT-67316 决策报表-客户模板是绝对布局固定大小的,复制客户模板里的tab到一个新建的绝对布局固定大小frm,保存关闭再打开新建模板,tab下的报表块尺寸变了 REPORT-73491 聚合报表条件属性配置面板,在设计器重启后该面板不能正确显示 REPORT-72851 去除无用导入 REPORT-72851 TitlePlaceProcessor 11.0.2之后版本不生效了 REPORT-73808 海外版alphafine功能问题 REPORT-71839 设计器启动时启动服务器,仍连曾断开的服务器,会有远程更新提醒 REPORT-71839 设计器启动时启动服务器,仍连曾断开的服务器,会有远程更新提醒 REPORT-71839 设计器启动时启动服务器,仍连曾断开的服务器,会有远程更新提醒 REPORT-71839 设计器启动时启动服务器,仍连曾断开的服务器,会有远程更新提醒 REPORT-70562 帮助文档 url更新 REPORT-70562 导出字体字号问题-添加配置 REPORT-72570 富文本导出问题 REPORT-71476 新建保存后,目录没有选中模板,重命名不应该高亮 同步到10.0 REPORT-73106 将参数面板控件剪切到一个新的cpt,原frm界面就变成和cpt一样persist/10.0 10.0.19.2022.07.16
superman
3 years ago
23 changed files with 309 additions and 49 deletions
@ -0,0 +1,42 @@
|
||||
package com.fr.design.form.util; |
||||
|
||||
import com.fr.base.Style; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import java.util.regex.Matcher; |
||||
import java.util.regex.Pattern; |
||||
|
||||
/** |
||||
* 富文本导出工具栏 |
||||
* |
||||
* @author hades |
||||
* @version 11.0 |
||||
* Created by hades on 2022/5/19 |
||||
*/ |
||||
public class HtmlPaintUtils { |
||||
|
||||
|
||||
private static final Pattern FONT_SIZE_PATTERN = Pattern.compile(Pattern.quote("font-size:") + "(.*?)" + Pattern.quote("px")); |
||||
|
||||
/** |
||||
* 设置单元格字体为富文本中的最大字体 |
||||
* |
||||
* @param style |
||||
*/ |
||||
public static Style deriveMaxFontFromRichChar(Style style, String html) { |
||||
int maxSize = style.getFRFont().getSize(); |
||||
Matcher matcher = FONT_SIZE_PATTERN.matcher(html); |
||||
while (matcher.find()) { |
||||
String value = matcher.group(1); |
||||
try { |
||||
double pxSize = Double.parseDouble(value); |
||||
int ptSize = FontTransformUtil.roundUp(FontTransformUtil.px2pt(pxSize)); |
||||
maxSize = Math.max(maxSize, ptSize); |
||||
} catch (Throwable e) { |
||||
FineLoggerFactory.getLogger().debug(e.getMessage(), e); |
||||
} |
||||
} |
||||
FRFont cellFont = style.getFRFont(); |
||||
return style.deriveFRFont(cellFont.applySize(maxSize)); |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.form.util; |
||||
|
||||
import com.fr.base.Style; |
||||
import junit.framework.TestCase; |
||||
import org.junit.Assert; |
||||
|
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 11.0 |
||||
* Created by hades on 2022/5/25 |
||||
*/ |
||||
public class HtmlPaintUtilsTest extends TestCase { |
||||
|
||||
public void testDeriveMaxFontFromRichChar() { |
||||
// 富文本字体size更大
|
||||
String testHtml0 = "<span style=\"font-size:21px;font-family:'宋体';\">这是一条测试数据</span>"; |
||||
Style style0 = Style.DEFAULT_STYLE; |
||||
Assert.assertEquals(16, HtmlPaintUtils.deriveMaxFontFromRichChar(style0, testHtml0).getFRFont().getSize()); |
||||
|
||||
// 单元格字体size更大
|
||||
String testHtml1 = "<span style=\"font-size:7px;font-family:'宋体';\">这是一条测试数据</span>"; |
||||
Style style1 = Style.DEFAULT_STYLE; |
||||
int oldFontSize = style1.getFRFont().getSize(); |
||||
Assert.assertEquals(oldFontSize, HtmlPaintUtils.deriveMaxFontFromRichChar(style1, testHtml1).getFRFont().getSize()); |
||||
|
||||
// 富文本字体size更大 不同文本 有不同size
|
||||
String testHtml2 = "<span style=\"font-size:21px;font-family:'宋体';\">这是一条测</span><span style=\"font-size:31px;font-family:'宋体';\">试数</span><span style=\"font-size:21px;font-family:'宋体';\">据</span>"; |
||||
Style style2 = Style.DEFAULT_STYLE; |
||||
Assert.assertEquals(23, HtmlPaintUtils.deriveMaxFontFromRichChar(style2, testHtml2).getFRFont().getSize()); |
||||
|
||||
|
||||
// 异常场景1
|
||||
String testHtml3 = "xxxx奇怪的格式xxxx"; |
||||
Style style3 = Style.DEFAULT_STYLE; |
||||
oldFontSize = style1.getFRFont().getSize(); |
||||
Assert.assertEquals(oldFontSize, HtmlPaintUtils.deriveMaxFontFromRichChar(style3, testHtml3).getFRFont().getSize()); |
||||
|
||||
// 异常场景2
|
||||
String testHtml4 = "<span style=\"font-size:xxxxpx;font-family:'宋体';\">这是一条测试数据</span>"; |
||||
Style style4 = Style.DEFAULT_STYLE; |
||||
oldFontSize = style1.getFRFont().getSize(); |
||||
Assert.assertEquals(oldFontSize, HtmlPaintUtils.deriveMaxFontFromRichChar(style4, testHtml4).getFRFont().getSize()); |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,81 @@
|
||||
package com.fr.design.report; |
||||
|
||||
import com.fr.base.CustomConfig; |
||||
import com.fr.config.Configuration; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.ActionLabel; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.utils.BrowseUtils; |
||||
import com.fr.general.CloudCenter; |
||||
import com.fr.transaction.Configurations; |
||||
import com.fr.transaction.WorkerFacade; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 11.0 |
||||
* Created by hades on 2022/5/26 |
||||
*/ |
||||
public class ExportUniversalPane extends BasicPane { |
||||
|
||||
private static final String HELP_URL = CloudCenter.getInstance().acquireUrlByKind("help.alt_font.zh_CN", "https://help.fanruan.com/finereport/doc-view-4707.html"); |
||||
|
||||
private UICheckBox specialCharacterExport; |
||||
|
||||
public ExportUniversalPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); |
||||
JPanel outerNorthPane =FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Config")); |
||||
JPanel northPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_M_Pane(); |
||||
JPanel specialCharacterExportPane =FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||
specialCharacterExport = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Special_Character")); |
||||
specialCharacterExport.setSelected(true); |
||||
specialCharacterExportPane.add(specialCharacterExport); |
||||
northPane.add(specialCharacterExportPane); |
||||
JPanel labelPane = new JPanel(new BorderLayout()); |
||||
labelPane.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
||||
UILabel centerLabel = new UILabel(Toolkit.i18nText("Fine-Design_Report_Universal_Export_Special_Character_Tip")); |
||||
centerLabel.setForeground(Color.GRAY); |
||||
ActionLabel rightLabel = new ActionLabel(Toolkit.i18nText("Fine-Design_Report_Universal_Export_More_Alternative_Fonts"), UIConstants.FLESH_BLUE); |
||||
rightLabel.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
BrowseUtils.browser(HELP_URL); |
||||
} |
||||
}); |
||||
labelPane.add(centerLabel, BorderLayout.CENTER); |
||||
labelPane.add(rightLabel, BorderLayout.EAST); |
||||
northPane.add(labelPane); |
||||
outerNorthPane.add(northPane); |
||||
this.add(outerNorthPane); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "ExportUniversalPane"; |
||||
} |
||||
|
||||
public void populate() { |
||||
this.specialCharacterExport.setSelected(CustomConfig.getInstance().isOptimizedSpecialCharacterExport()); |
||||
} |
||||
|
||||
public void update() { |
||||
Configurations.modify(new WorkerFacade(CustomConfig.class) { |
||||
@Override |
||||
public void run() { |
||||
CustomConfig.getInstance().setOptimizedSpecialCharacterExport(specialCharacterExport.isSelected()); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue