Browse Source

Merge pull request #9393 in DESIGN/design from final/10.0 to persist/10.0

* 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 2 years ago
parent
commit
510f717826
  1. 2
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 3
      designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java
  3. 3
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  4. 11
      designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java
  5. 1
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  6. 3
      designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java
  7. 19
      designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java
  8. 10
      designer-base/src/main/java/com/fr/start/BaseDesigner.java
  9. 2
      designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java
  10. 18
      designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java
  11. 18
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  12. 5
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  13. 8
      designer-form/src/main/java/com/fr/design/form/util/FontTransformUtil.java
  14. 42
      designer-form/src/main/java/com/fr/design/form/util/HtmlPaintUtils.java
  15. 18
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  16. 4
      designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java
  17. 49
      designer-form/src/test/java/com/fr/design/form/util/HtmlPaintUtilsTest.java
  18. 9
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextCellEditor.java
  19. 4
      designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java
  20. 81
      designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java
  21. 13
      designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java
  22. 17
      designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java
  23. 12
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

2
designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java

@ -427,9 +427,11 @@ public class EnvChangeEntrance {
DesignerExiter.getInstance().execute(); DesignerExiter.getInstance().execute();
} else { } else {
updateNotRememberPwdEnv(); updateNotRememberPwdEnv();
if (DesignerContext.getDesignerFrame().isVisible()) {
VersionCheckUtils.showVersionCheckDialog(envListPane.getSelectedName()); VersionCheckUtils.showVersionCheckDialog(envListPane.getSelectedName());
} }
} }
}
@Override @Override
public void doCancel() { public void doCancel() {

3
designer-base/src/main/java/com/fr/design/actions/help/alphafine/AlphaFineConfigManager.java

@ -1,5 +1,6 @@
package com.fr.design.actions.help.alphafine; package com.fr.design.actions.help.alphafine;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.license.function.VT4FR; import com.fr.license.function.VT4FR;
@ -442,7 +443,7 @@ public class AlphaFineConfigManager implements XMLable {
} }
public boolean isProductDynamics() { public boolean isProductDynamics() {
return productDynamics; return productDynamics && FRContext.isChineseEnv();
} }
public void setProductDynamics(boolean productDynamics) { public void setProductDynamics(boolean productDynamics) {

3
designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java

@ -1,5 +1,6 @@
package com.fr.design.data.datapane.connect; package com.fr.design.data.datapane.connect;
import com.fr.base.TemplateUtils;
import com.fr.data.core.db.JDBCSecurityChecker; import com.fr.data.core.db.JDBCSecurityChecker;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
@ -195,7 +196,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
Connection connection = entry.getValue(); Connection connection = entry.getValue();
if (connection instanceof JDBCDatabaseConnection) { if (connection instanceof JDBCDatabaseConnection) {
try { try {
JDBCSecurityChecker.checkURL(((JDBCDatabaseConnection) connection).getURL()); JDBCSecurityChecker.checkURL(TemplateUtils.render(((JDBCDatabaseConnection) connection).getURL()));
JDBCSecurityChecker.checkValidationQuery(((JDBCDatabaseConnection) connection).getDbcpAttr().getValidationQuery()); JDBCSecurityChecker.checkValidationQuery(((JDBCDatabaseConnection) connection).getDbcpAttr().getValidationQuery());
} catch (SQLException e) { } catch (SQLException e) {
throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", entry.getKey()) + ", " + e.getMessage(), e.getCause()); throw new SQLException(Toolkit.i18nText("Fine-Design_Basic_Database_Connection_Invalid_Config", entry.getKey()) + ", " + e.getMessage(), e.getCause());

11
designer-base/src/main/java/com/fr/design/gui/ilable/ActionLabel.java

@ -13,11 +13,16 @@ import java.awt.event.MouseEvent;
*/ */
public class ActionLabel extends UILabel { public class ActionLabel extends UILabel {
private ActionListener actionListener; private ActionListener actionListener;
private Color color;
public ActionLabel(String text) { public ActionLabel(String text) {
super(text); this(text, Color.blue);
}
this.setForeground(Color.blue); public ActionLabel(String text, Color color) {
super(text);
this.color = color;
this.setForeground(color);
this.addMouseListener(mouseInputAdapter); this.addMouseListener(mouseInputAdapter);
this.addMouseMotionListener(mouseInputAdapter); this.addMouseMotionListener(mouseInputAdapter);
} }
@ -33,7 +38,7 @@ public class ActionLabel extends UILabel {
public void paintComponent(Graphics _gfx) { public void paintComponent(Graphics _gfx) {
super.paintComponent(_gfx); super.paintComponent(_gfx);
_gfx.setColor(Color.blue); _gfx.setColor(this.color);
_gfx.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1); _gfx.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1);
} }

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

@ -1555,6 +1555,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
refreshToolArea(); refreshToolArea();
} }
DesignerFrameFileDealerPane.getInstance().refresh(); DesignerFrameFileDealerPane.getInstance().refresh();
DesignerFrameFileDealerPane.getInstance().stateChange();
} }
}); });

3
designer-base/src/main/java/com/fr/design/mainframe/NorthRegionContainerPane.java

@ -100,8 +100,7 @@ public class NorthRegionContainerPane extends JPanel {
//优先级为-1,保证最后全面刷新一次 //优先级为-1,保证最后全面刷新一次
GeneralContext.listenPluginRunningChanged(pluginOnRunOrStopListener, pluginFilter); GeneralContext.listenPluginRunningChanged(pluginOnRunOrStopListener, pluginFilter);
// 在设计器启动时仅在最后一个插件启用时候进行刷新一次 如果插件启用过程中存在实现了设计器接口的插件 // 在设计器启动时仅在最后一个插件启用时候进行刷新一次 如果插件启用过程中存在实现了设计器接口的插件
boolean needRefresh = DesignerContext.getDesignerFrame() != null && DesignerContext.getDesignerFrame().isVisible() && existDesignExtraPlugin; if (existDesignExtraPlugin) {
if (needRefresh) {
refreshAll(northEastPane, ad); refreshAll(northEastPane, ad);
} }
} }

19
designer-base/src/main/java/com/fr/design/versioncheck/VersionCheckUtils.java

@ -52,6 +52,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.swing.SwingWorker;
/** /**
* @author pengda * @author pengda
@ -95,9 +96,23 @@ public class VersionCheckUtils {
} }
public static void showVersionCheckDialog(String envName) { public static void showVersionCheckDialog(String envName) {
if (!VersionCheckUtils.versionCheck(envName)) { new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() {
return !VersionCheckUtils.versionCheck(envName);
}
@Override
protected void done() {
try {
if (get()) {
showNotificationDialog(envName); showNotificationDialog(envName);
} }
} catch (Exception e) {
FineLoggerFactory.getLogger().warn(e.getMessage(), e);
}
}
}.execute();
} }
private static void showNotificationDialog(String envName) { private static void showNotificationDialog(String envName) {
@ -294,7 +309,7 @@ public class VersionCheckUtils {
private static boolean isPluginNeedIgnore(JSONObject remotePlugin) { private static boolean isPluginNeedIgnore(JSONObject remotePlugin) {
return ComparatorUtils.equals(remotePlugin.getString(RUNNING), "false") || (remotePlugin.containsKey(SYNC) && !remotePlugin.getBoolean(SYNC)) return ComparatorUtils.equals(remotePlugin.getString(RUNNING), "false") || (remotePlugin.containsKey(SYNC) && !remotePlugin.getBoolean(SYNC))
|| (remotePlugin.containsKey(GROUP) && ComparatorUtils.equals(remotePlugin.containsKey(GROUP), BI) || remotePlugin.getString(ID).startsWith(BIPREFIX) || (remotePlugin.containsKey(GROUP) && ComparatorUtils.equals(remotePlugin.getString(GROUP), BI) || remotePlugin.getString(ID).startsWith(BIPREFIX)
|| pluginsNeedIgnore.contains(remotePlugin.getString(ID))); || pluginsNeedIgnore.contains(remotePlugin.getString(ID)));
} }

10
designer-base/src/main/java/com/fr/start/BaseDesigner.java

@ -16,6 +16,7 @@ import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.toolbar.ToolBarMenuDock; import com.fr.design.mainframe.toolbar.ToolBarMenuDock;
import com.fr.design.monitor.DesignerLifecycleMonitorContext; import com.fr.design.monitor.DesignerLifecycleMonitorContext;
import com.fr.design.ui.util.UIUtil; import com.fr.design.ui.util.UIUtil;
import com.fr.design.versioncheck.VersionCheckUtils;
import com.fr.event.Event; import com.fr.event.Event;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.event.Listener; import com.fr.event.Listener;
@ -84,10 +85,19 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue())); eventPipe.fire(new CarryMessageEvent(ReportState.STOP.getValue()));
} }
collectUserInformation(); collectUserInformation();
checkVersion();
} }
}); });
} }
private void checkVersion() {
try {
VersionCheckUtils.showVersionCheckDialog(DesignerEnvManager.getEnvManager().getCurEnvName());
} catch (Exception e) {
FineLoggerFactory.getLogger().warn("Check Service Failed");
}
}
public void show() { public void show() {
UIUtil.invokeLaterIfNeeded(this::refreshTemplateTree); UIUtil.invokeLaterIfNeeded(this::refreshTemplateTree);
} }

2
designer-chart/src/main/java/com/fr/design/mainframe/chart/ChartEditPane.java

@ -411,7 +411,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, Prepare
this.addAncestorListener(new ManageDsListenerRegisterListener(new ChangeListener() { this.addAncestorListener(new ManageDsListenerRegisterListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
AbstractChartAttrPane attrPane = paneList.get(tabsHeaderIconPane.getSelectedIndex()); AbstractChartAttrPane attrPane = paneList.get(tabsHeaderIconPane.getSelectedIndex());
if (attrPane.isShowing()) { if (attrPane.isShowing() && collection != null) {
attrPane.refreshChartDataPane(collection); attrPane.refreshChartDataPane(collection);
} }
} }

18
designer-form/src/main/java/com/fr/design/designer/beans/models/SelectionModel.java

@ -25,7 +25,6 @@ import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelection; import com.fr.design.mainframe.FormSelection;
import com.fr.design.mainframe.FormSelectionUtils; import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -140,11 +139,28 @@ public class SelectionModel {
if (cutSelection != null) { if (cutSelection != null) {
cutSelection.cut2ClipBoard(clipboard); cutSelection.cut2ClipBoard(clipboard);
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_CUTED);
setSelectedCreator(hasSelectedParaComponent() ? designer.getParaComponent() : designer.getRootComponent());
designer.repaint(); designer.repaint();
} }
} }
} }
/**
* 判断是否选中参数面板中的组件
* @return boolean
*/
private boolean hasSelectedParaComponent() {
XCreator[] roots = selection.getSelectedCreators();
if (roots.length > 0) {
for (XCreator creator : roots) {
if ((creator.getParent() instanceof XWParameterLayout)) {
return true;
}
}
}
return false;
}
/** /**
* 复制当前选中的组件到剪切板 * 复制当前选中的组件到剪切板
*/ */

18
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -401,4 +401,22 @@ public class XCreatorUtils {
} }
return container; return container;
} }
/**
* 循环遍历组件调整组件间隙
* @param creator
*/
//循环遍历布局,按百分比调整子组件大小
public static void traverAndAdjust(XCreator creator, double percent) {
for (int i = 0; i < creator.getComponentCount(); i++) {
Object object = creator.getComponent(i);
if (object instanceof XCreator) {
XCreator temp = (XCreator) object;
temp.adjustCompSize(percent);
traverAndAdjust(temp, percent);
}
}
}
} }

5
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -472,4 +472,9 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
public void setShowOuterShadowBorder(boolean showOuterShadowBorder) { public void setShowOuterShadowBorder(boolean showOuterShadowBorder) {
this.showOuterShadowBorder = showOuterShadowBorder; this.showOuterShadowBorder = showOuterShadowBorder;
} }
@Override
public void recalculateChildrenSize() {
}
} }

8
designer-form/src/main/java/com/fr/design/form/util/FontTransformUtil.java

@ -5,6 +5,7 @@ import com.fr.design.ExtraDesignClassManager;
import com.fr.design.fun.FormAdaptiveConfigUIProcessor; import com.fr.design.fun.FormAdaptiveConfigUIProcessor;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.unit.PT; import com.fr.stable.unit.PT;
import java.math.BigDecimal;
/** /**
@ -43,4 +44,11 @@ public class FontTransformUtil {
return value * (double) Constants.DEFAULT_FONT_PAINT_RESOLUTION / (double) getDesignerFontResolution(); return value * (double) Constants.DEFAULT_FONT_PAINT_RESOLUTION / (double) getDesignerFontResolution();
} }
public static int roundUp(double num) {
String numStr = Double.toString(num);
numStr = new BigDecimal(numStr).setScale(0, BigDecimal.ROUND_HALF_UP).toString();
return Integer.valueOf(numStr);
}
} }

42
designer-form/src/main/java/com/fr/design/form/util/HtmlPaintUtils.java

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

18
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -5,6 +5,7 @@ import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.designer.beans.events.DesignerEditListener; import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
@ -428,7 +429,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
if (root.acceptType(XWFitLayout.class)) { if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root; XWFitLayout layout = (XWFitLayout) root;
layout.setContainerPercent(value / DEFAULT_SLIDER); layout.setContainerPercent(value / DEFAULT_SLIDER);
traverAndAdjust(layout, percent); XCreatorUtils.traverAndAdjust(layout, percent);
layout.adjustCreatorsWhileSlide(percent); layout.adjustCreatorsWhileSlide(percent);
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小 // 拖动滑块,先将内部组件百分比大小计算,再计算容器大小
@ -464,7 +465,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
if (root.acceptType(XWFitLayout.class)) { if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root; XWFitLayout layout = (XWFitLayout) root;
layout.setContainerPercent(1.0); layout.setContainerPercent(1.0);
traverAndAdjust(layout, 0.0); XCreatorUtils.traverAndAdjust(layout, 0.0);
layout.adjustCreatorsWhileSlide(0.0); layout.adjustCreatorsWhileSlide(0.0);
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小 // 拖动滑块,先将内部组件百分比大小计算,再计算容器大小
@ -487,19 +488,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
} }
} }
//循环遍历布局,按百分比调整子组件大小
private void traverAndAdjust(XCreator creator, double percent) {
for (int i = 0; i < creator.getComponentCount(); i++) {
Object object = creator.getComponent(i);
if (object instanceof XCreator) {
XCreator temp = (XCreator) object;
temp.adjustCompSize(percent);
traverAndAdjust(temp, percent);
}
}
}
/** /**
* 增加刻度条 * 增加刻度条
*/ */

4
designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java

@ -16,6 +16,7 @@ import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WTitleLayout;
@ -291,6 +292,9 @@ public class FormSelectionUtils {
public static XCreator copyXcreator(Form form, XCreator xCreator) throws CloneNotSupportedException{ public static XCreator copyXcreator(Form form, XCreator xCreator) throws CloneNotSupportedException{
Widget copied = (Widget) xCreator.toData().clone(); Widget copied = (Widget) xCreator.toData().clone();
XCreator copiedCreator = XCreatorUtils.createXCreator(copied, xCreator.getSize()); XCreator copiedCreator = XCreatorUtils.createXCreator(copied, xCreator.getSize());
//主要用来处理组件间隔和padding,保证界面上展示的组件尺寸是计算过padding和组件间隔的
LayoutUtils.layoutContainer(copiedCreator);
XCreatorUtils.traverAndAdjust(copiedCreator, 0.0);
ArrayList<String> nameSpace = new ArrayList<>(); ArrayList<String> nameSpace = new ArrayList<>();
copyWidgetName(form, nameSpace, copiedCreator); copyWidgetName(form, nameSpace, copiedCreator);
return copiedCreator; return copiedCreator;

49
designer-form/src/test/java/com/fr/design/form/util/HtmlPaintUtilsTest.java

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

9
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextCellEditor.java

@ -1,5 +1,8 @@
package com.fr.design.cell.editor; package com.fr.design.cell.editor;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.GeneralUtils;
import com.fr.design.form.util.HtmlPaintUtils;
import java.awt.Component; import java.awt.Component;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@ -42,6 +45,11 @@ public class RichTextCellEditor extends AbstractCellEditor implements
@Override @Override
public void doOk() { public void doOk() {
RichTextCellEditor.this.fireEditingStopped(); RichTextCellEditor.this.fireEditingStopped();
CellElement newCellElement = parentTplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow());
if (cellElement.getCellGUIAttr().isShowAsHTML()) {
newCellElement.setStyle(HtmlPaintUtils.deriveMaxFontFromRichChar(newCellElement.getStyle(), GeneralUtils.objectToString(newCellElement.getValue())));
DesignerContext.getDesignerFrame().refreshToolbar();
}
} }
@Override @Override
@ -49,7 +57,6 @@ public class RichTextCellEditor extends AbstractCellEditor implements
RichTextCellEditor.this.fireEditingCanceled(); RichTextCellEditor.this.fireEditingCanceled();
} }
}); });
richTextDialog.addDialogActionListener(this);
this.richTextPane.populate(parentTplEC, cellElement); this.richTextPane.populate(parentTplEC, cellElement);
setShowAsHtml(cellElement); setShowAsHtml(cellElement);

4
designer-realize/src/main/java/com/fr/design/cell/editor/RichTextToolBar.java

@ -366,9 +366,7 @@ public class RichTextToolBar extends BasicPane {
}; };
private int roundUp(double num) { private int roundUp(double num) {
String numStr = Double.toString(num); return FontTransformUtil.roundUp(num);
numStr = new BigDecimal(numStr).setScale(0, BigDecimal.ROUND_HALF_UP).toString();
return Integer.valueOf(numStr);
} }
private CaretListener textCareListener = new CaretListener() { private CaretListener textCareListener = new CaretListener() {

81
designer-realize/src/main/java/com/fr/design/report/ExportUniversalPane.java

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

13
designer-realize/src/main/java/com/fr/design/report/ReportExportAttrPane.java

@ -5,6 +5,7 @@ import com.fr.design.beans.BasicStorePane;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.ExportAttrTabProvider; import com.fr.design.fun.ExportAttrTabProvider;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.i18n.Toolkit;
import com.fr.io.attr.ReportExportAttr; import com.fr.io.attr.ReportExportAttr;
import javax.swing.*; import javax.swing.*;
@ -17,12 +18,15 @@ public class ReportExportAttrPane extends BasicPane {
private ExcelExportPane excelExportPane; private ExcelExportPane excelExportPane;
private PDFExportPane pdfExportPane; private PDFExportPane pdfExportPane;
private WordExportPane wordExportPane; private WordExportPane wordExportPane;
private ExportUniversalPane exportUniversalPane;
private List<BasicStorePane<?>> paneList; private List<BasicStorePane<?>> paneList;
public ReportExportAttrPane() { public ReportExportAttrPane() {
UITabbedPane uiTabbedPane = new UITabbedPane(); UITabbedPane uiTabbedPane = new UITabbedPane();
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
exportUniversalPane = new ExportUniversalPane();
uiTabbedPane.addTab(Toolkit.i18nText("Fine-Design_Report_Universal_Export"), exportUniversalPane);
excelExportPane = new ExcelExportPane(); excelExportPane = new ExcelExportPane();
uiTabbedPane.addTab("Excel", excelExportPane); uiTabbedPane.addTab("Excel", excelExportPane);
pdfExportPane = new PDFExportPane(); pdfExportPane = new PDFExportPane();
@ -49,6 +53,10 @@ public class ReportExportAttrPane extends BasicPane {
reportExportAttr = new ReportExportAttr(); reportExportAttr = new ReportExportAttr();
} }
if (this.exportUniversalPane != null) {
this.exportUniversalPane.populate();
}
if (this.excelExportPane != null) { if (this.excelExportPane != null) {
this.excelExportPane.populate(reportExportAttr.getExcelExportAttr()); this.excelExportPane.populate(reportExportAttr.getExcelExportAttr());
} }
@ -69,6 +77,11 @@ public class ReportExportAttrPane extends BasicPane {
public ReportExportAttr update() { public ReportExportAttr update() {
ReportExportAttr reportExportAttr = new ReportExportAttr(); ReportExportAttr reportExportAttr = new ReportExportAttr();
if (this.exportUniversalPane != null) {
this.exportUniversalPane.update();
}
if (this.excelExportPane != null) { if (this.excelExportPane != null) {
reportExportAttr.setExcelExportAttr(this.excelExportPane.update()); reportExportAttr.setExcelExportAttr(this.excelExportPane.update());
} }

17
designer-realize/src/main/java/com/fr/poly/creator/ECBlockEditor.java

@ -3,7 +3,6 @@
*/ */
package com.fr.poly.creator; package com.fr.poly.creator;
import com.fr.base.BaseUtils;
import com.fr.base.ScreenResolution; import com.fr.base.ScreenResolution;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
@ -11,7 +10,15 @@ import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener; import com.fr.design.event.TargetModifiedListener;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.CellWidgetPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EastRegionContainerPane;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mainframe.JWorkBook;
import com.fr.design.mainframe.ReportFloatPane;
import com.fr.design.mainframe.cell.QuickEditorRegion; import com.fr.design.mainframe.cell.QuickEditorRegion;
import com.fr.design.present.ConditionAttributesGroupPane; import com.fr.design.present.ConditionAttributesGroupPane;
import com.fr.grid.GridUtils; import com.fr.grid.GridUtils;
@ -26,8 +33,9 @@ import com.fr.report.poly.PolyECBlock;
import com.fr.stable.unit.UNITConstants; import com.fr.stable.unit.UNITConstants;
import com.fr.stable.unit.UnitRectangle; import com.fr.stable.unit.UnitRectangle;
import javax.swing.*; import javax.swing.JPanel;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Dimension;
/** /**
* @author richer * @author richer
@ -166,6 +174,7 @@ public class ECBlockEditor extends BlockEditor<ECBlockPane, PolyECBlock> {
// 条件属性 // 条件属性
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance(); ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(editComponent); conditionAttributesGroupPane.populate(editComponent);
EastRegionContainerPane.getInstance().replaceConditionAttrPane(conditionAttributesGroupPane);
EastRegionContainerPane.getInstance().updateCellElementState(isSelectedOneCell()); EastRegionContainerPane.getInstance().updateCellElementState(isSelectedOneCell());
if (chooseBlock) { if (chooseBlock) {

12
designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceProvider.java

@ -61,18 +61,6 @@ public class DesignerWorkspaceProvider extends Activator {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(null, workspaceInfo); EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(null, workspaceInfo);
} else { } else {
WorkContext.switchTo(workspace); WorkContext.switchTo(workspace);
//在设计器完全启动完成后,对初始环境进行一次服务检测,对主要功能无影响,异常仅做日志提示即可
final String selectEnv = current;
EventDispatcher.listen(DesignerLaunchStatus.STARTUP_COMPLETE, new Listener<Null>() {
@Override
public void on(Event event, Null aNull) {
try {
VersionCheckUtils.showVersionCheckDialog(selectEnv);
} catch (Exception e) {
FineLoggerFactory.getLogger().warn("Check Service Failed");
}
}
});
} }
} catch (Throwable e) { } catch (Throwable e) {
EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(e, workspaceInfo); EnvChangeEntrance.getInstance().dealEvnExceptionWhenStartDesigner(e, workspaceInfo);

Loading…
Cancel
Save