Browse Source

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

* commit '8385012f63471e90701b852d629b3df79d07d682':
  REPORT-74100【冒烟】远程BI环境,13个jar全部提示缺失 BI 集成的 JAR 或者之前的环境, 这里需要进行判断是否需要进行检查。
  REPORT-73970 手动修改参数面板宽度未生效 1、REPORT-66771改动导致,在dolayout的时候修改了组件宽度 2、改为,在form宽度修改事件中修改组件宽度
  REPORT-73996-新建frm预览空白
  KERNEL-11531  修改下设计,ColoneCollector中触发clone()
  REPORT-73802 【设计器环境监测】windows下没有finedb权限,首次启动设计器能起来,第二次就启动失败了
  KERNEL-11531 数据链接越权漏洞调用com.fr.invoke.ClassHelper中遍历搜索对象存在空间时间效率问题导致宕机
  单独写一个 DefaultLoginKeys
  REPORT-72595 FR源码中存在加密密钥硬编码,建议放到配置文件中
  REPORT-73833【设计器环境检测】本地目录,只有finedb异常,自动弹窗没弹 需要对使用后埋点。之前是使用的 Stream. 埋点后 Stream 流就不能用了。 这边换成 Collection 适配一下。
  REPORT-73811 图表条件属性汇总字段值,汇总方式下拉内容显示了两遍
  REPORT-72819 弹窗显示不全
  KERNEL-11517 实现主题色时ClassHelper中遍历搜索对象存在性能问题
feature/x
superman 2 years ago
parent
commit
1738f9b933
  1. 48
      designer-base/src/main/java/com/fr/design/login/config/DefaultLoginKeys.java
  2. 9
      designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java
  3. 8
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  4. 10
      designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java
  5. 37
      designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java
  6. 66
      designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java
  7. 5
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  8. 144
      designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListExtendedPane.java
  9. 6
      designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java
  10. 13
      designer-base/src/main/java/com/fr/env/detect/base/DetectorBridge.java
  11. 5
      designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java
  12. 1
      designer-base/src/main/resources/com/fr/design/config/default
  13. 2
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties
  14. 2
      designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties
  15. 6
      designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java
  16. 17
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  17. 8
      designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java
  18. 7
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  19. 6
      designer-form/src/main/java/com/fr/design/mainframe/JForm.java
  20. 4
      designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java
  21. 7
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  22. 5
      designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java
  23. 5
      designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java
  24. 6
      designer-realize/src/main/java/com/fr/start/module/optimized/BaseDBActivator4Designer.java

48
designer-base/src/main/java/com/fr/design/login/config/DefaultLoginKeys.java

@ -0,0 +1,48 @@
package com.fr.design.login.config;
import com.fr.log.FineLoggerFactory;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
/**
* @author Lanlan
* @version 10.0
* Created by Lanlan on 2022/6/20
*/
public class DefaultLoginKeys {
private static final String FILENAME = "com/fr/design/config/default";
private static final DefaultLoginKeys INSTANCE = new DefaultLoginKeys();
public static DefaultLoginKeys getInstance() {
return INSTANCE;
}
private final Map<String, String> keys = new HashMap<>();
private DefaultLoginKeys() {
Properties properties = load();
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
String name = entry.getKey().toString();
keys.put(name, entry.getValue().toString());
}
}
public String getKey(String name) {
return keys.get(name);
}
private Properties load() {
Properties properties = new Properties();
try (InputStream inputStream = DefaultLoginKeys.class.getClassLoader().getResourceAsStream(FILENAME)) {
properties.load(inputStream);
} catch (IOException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return properties;
}
}

9
designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java

@ -1,6 +1,7 @@
package com.fr.design.login.utils;
import com.fr.design.DesignerEnvManager;
import com.fr.design.login.config.DefaultLoginKeys;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import com.fr.general.CloudCenter;
import com.fr.general.CloudCenterConfig;
@ -28,8 +29,6 @@ public class DesignerLoginUtils {
private static final String PRODUCT_FINEREPORT = "product-finereport";
private static final String KEY = "i7hP48WAcuTrmxfN";
public static Map<String, String> renderMap() {
Map<String, String> map4Tpl = new HashMap<>();
map4Tpl.put("language", GeneralContext.getLocale().toString());
@ -86,7 +85,11 @@ public class DesignerLoginUtils {
jo.put("username", manager.getDesignerLoginUsername());
jo.put("source", PRODUCT_FINEREPORT);
byte[] iv = randomIv();
return new String(Hex.encode(iv)) + encrypt(jo.toString(), KEY.getBytes(), iv);
return new String(Hex.encode(iv)) + encrypt(
jo.toString(),
DefaultLoginKeys.getInstance().getKey("Fine-Designer_Login").getBytes(),
iv
);
}
private static byte[] randomIv() {

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

@ -201,7 +201,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} else if (!DesignModeContext.isVcsMode() && !DesignModeContext.isAuthorityEditing() && !DesignModeContext.isDuchampMode()) {
DesignModeContext.switchTo(com.fr.design.base.mode.DesignerMode.NORMAL);
}
this.template = t;
this.template = getTarget();
this.previewType = parserPreviewProvider(t.getPreviewType());
this.editingFILE = file;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -213,10 +213,6 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
}
addCenterPane();
isNewCreateTpl = isNewFile;
if (isNewCreateTpl) {
// REPORT-58486: 必须在初始的UndoState创建前设置主题,使得初始的UndoState就包含了主题效果
setUpTheme4NewTemplate();
}
this.undoState = createUndoState();
initAndStartPlugin();
@ -1949,11 +1945,13 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
@Override
public void setTemplateTheme(TemplateTheme newTheme, TemplateThemeCompatible compatible) {
if (templateThemeButton != null) {
ThemedTemplate.super.setTemplateTheme(newTheme, compatible);
String name = newTheme.getName();
templateThemeButton.setText(name);
templateThemeButton.setToolTipText(name);
}
}
/**
* 定位

10
designer-base/src/main/java/com/fr/design/mainframe/JTemplateFactory.java

@ -1,7 +1,12 @@
package com.fr.design.mainframe;
import com.fr.base.io.BaseBook;
import com.fr.base.theme.FineColorGather;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FineColorSynchronizer;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.file.FILE;
import com.fr.form.main.Form;
import com.fr.stable.CoreConstants;
import com.fr.stable.StringUtils;
@ -34,10 +39,7 @@ public final class JTemplateFactory {
String[] defaultAppExtensions = app.defaultExtensions();
for (String defaultAppExtension : defaultAppExtensions) {
if (defaultAppExtension.equalsIgnoreCase(fileExtension)) {
JTemplate<?, ?> jt = app.openTemplate(file);
if (jt != null) {
return jt;
}
return app.openTemplate(file);
}
}
}

37
designer-base/src/main/java/com/fr/design/mainframe/authority/AuthorityTargetObjectCollector.java

@ -0,0 +1,37 @@
package com.fr.design.mainframe.authority;
import com.fr.base.CloneCollector;
import com.fr.base.Formula;
import com.fr.data.impl.NameDatabaseConnection;
import com.fr.data.impl.NameTableData;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.stable.FCloneable;
import java.util.ArrayList;
import java.util.List;
public class AuthorityTargetObjectCollector extends CloneCollector {
List<Object> targetObject = new ArrayList<>();
public AuthorityTargetObjectCollector(FCloneable rootObject) {
super(rootObject);
}
@Override
public void collect(Object object) {
if (object instanceof DSColumn || object instanceof Formula
|| object instanceof NameDatabaseConnection || object instanceof NameTableData) {
targetObject.add(object);
}
}
public List<Object> collectTargetObject() {
CloneCollector.setCollector(this);
this.targetObject = new ArrayList<>();
this.collect();
CloneCollector.clearCollector();
return targetObject;
}
}

66
designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java

@ -1,24 +1,24 @@
package com.fr.design.mainframe.authority;
import com.fr.base.CloneCollector;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.mod.ModClassFilter;
import com.fr.file.ConnectionConfig;
import com.fr.file.TableDataConfig;
import com.fr.invoke.ClassHelper;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.Filter;
import com.fr.workspace.WorkContext;
import com.fr.workspace.server.authority.user.UserAuthority;
import java.util.Collection;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -77,33 +77,42 @@ public class JTemplateAuthorityChecker {
public boolean isAuthority() {
long s = System.currentTimeMillis();
//遍历模板对象,根据checkerMap.keySet()把感兴趣的对象找出来
Map<String, Collection<Object>> targetObjects = ClassHelper.searchObject(jTemplate.getTarget(), checkerMap.keySet(), ClassFilter.getInstance());
List<Object> targetObjects = getTargetObjects();
//找到对应的checker,对对象进行检查
for (String name : targetObjects.keySet()) {
for (Object targetObject : targetObjects) {
String name = targetObject.getClass().getName();
ElementAuthorityChecker checker = checkerMap.get(name);
for (Object object : targetObjects.get(name)) {
if (authConnectionNames != null) {
Set<String> noAuthName = checker.getNoAuthConnectionNames(object, authConnectionNames);
Set<String> noAuthName = checker.getNoAuthConnectionNames(targetObject, authConnectionNames);
if (noAuthName != null) {
authFailConnectionNames.addAll(noAuthName);
}
}
if (authDatasetNames != null) {
Set<String> noAuthName = checker.getNoAuthDatasetNames(object, authDatasetNames);
Set<String> noAuthName = checker.getNoAuthDatasetNames(targetObject, authDatasetNames);
if (noAuthName != null) {
authFailDatasetNames.addAll(noAuthName);
}
}
}
}
authFailConnectionNames.retainAll(allConnectionNames);
authFailDatasetNames.retainAll(allDatasetNames);
FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s));
return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0;
}
private List<Object> getTargetObjects() {
List<Object> targetObjects = new ArrayList<>();
try {
AuthorityTargetObjectCollector authorityTargetObjectCollector
= new AuthorityTargetObjectCollector(jTemplate.getTarget());
targetObjects = authorityTargetObjectCollector.collectTargetObject();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return targetObjects;
}
public void showAuthorityFailPromptDialog() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(Toolkit.i18nText("Fine-Design-Basic_Save_Failure"));
@ -151,38 +160,5 @@ public class JTemplateAuthorityChecker {
return stringBuffer.toString();
}
static class ClassFilter implements Filter<String> {
private static final Set<String> FILTER_SET = new HashSet<>();
private static final Set<String> START_WITH_SET = new HashSet<>();
private static final Filter<String> INSTANCE = new ModClassFilter();
public static Filter<String> getInstance() {
return INSTANCE;
}
static {
FILTER_SET.add("java.awt.image.BufferedImage");
FILTER_SET.add("sun.awt.AppContext");
FILTER_SET.add("com.fr.poly.creator.ECBlockCreator");
FILTER_SET.add("io.netty.channel.nio.SelectedSelectionKeySet");
FILTER_SET.add("com.fr.form.ui.ElementCaseImage");
FILTER_SET.add("this$0");
START_WITH_SET.add("com.fr.design");
}
@Override
public boolean accept(String s) {
if (FILTER_SET.contains(s)) {
return true;
}
for (String start : START_WITH_SET) {
if (s.startsWith(start)) {
return true;
}
}
return false;
}
}
}

5
designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java

@ -2,6 +2,7 @@ package com.fr.design.mainframe.theme;
import com.fr.base.theme.FineColorFlushUtils;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FineColorSynchronizer;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedCellStyleList;
@ -157,10 +158,8 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
return container;
}
private void onColorSchemeChanged(List<Color> colors) {
FineColorManager.FineColorReplaceByColorScheme replaceByColorScheme = new FineColorManager.FineColorReplaceByColorScheme(colors);
T theme = updateBean();
FineColorFlushUtils.replaceCacheObject(theme, replaceByColorScheme);
FineColorManager.traverse(theme, replaceByColorScheme);
theme = (T) FineColorSynchronizer.flush(theme, colors);
populateBean4CustomEditors(theme);
this.repaint();
}

144
designer-base/src/main/java/com/fr/design/mainframe/theme/edit/ui/ColorListExtendedPane.java

@ -1,144 +0,0 @@
package com.fr.design.mainframe.theme.edit.ui;
import com.fr.base.theme.FineColorManager;
import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.JPanel;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.List;
/**
* @author Starryi
* @version 1.0
* Created by Starryi on 2021/8/7
*/
public class ColorListExtendedPane extends JPanel implements MouseListener {
public static final int DEFAULT_COLOR_COUNT = 8;
public static final int DEFAULT_EXTENDED_COUNT = 5;
public static final int DEFAULT_COLOR_SIZE = 16;
public static final int DEFAULT_COLOR_GAP = 3;
public static final ExtendedColorComputer DEFAULT_EXTENDED_COMPUTER = new ExtendedColorComputer() {
@Override
public Color computeExtendedColor(Color color, int index, int count) {
return FineColorManager.computeExtendedColor(color, index, count);
}
};
private final boolean selectable;
private final int colorCount;
private final int extendedCount;
private final int boxSize;
private final int boxGap;
private final List<Color> colorList = new ArrayList<>();
private ExtendedColorComputer extendedColorComputer = DEFAULT_EXTENDED_COMPUTER;
private int selectedColorIndex = -1;
private int selectedExtendedIndex = -1;
public ColorListExtendedPane() {
this(false, DEFAULT_COLOR_COUNT, DEFAULT_EXTENDED_COUNT, DEFAULT_COLOR_SIZE, DEFAULT_COLOR_GAP);
}
public ColorListExtendedPane(boolean selectable, int colorCount, int extendedCount, int boxSize, int boxGap) {
setLayout(FRGUIPaneFactory.createBorderLayout());
this.selectable = selectable;
this.colorCount = Math.max(1, colorCount);
this.extendedCount = extendedCount;
this.boxSize = boxSize;
this.boxGap = boxGap;
for (int i = 0; i < colorCount; i++) {
colorList.add(Color.WHITE);
}
int width = colorCount * boxSize + (colorCount - 1) * boxGap;
int height = extendedCount * boxSize + (extendedCount - 1) * boxGap;
setPreferredSize(new Dimension(width, height));
}
public void populate(List<Color> colors) {
if (colors.size() > 0) {
colorList.clear();
colorList.addAll(colors);
repaint();
}
}
public List<Color> update() {
return new ArrayList<>(colorList);
}
public void setExtendedColorComputer(ExtendedColorComputer extendedColorComputer) {
this.extendedColorComputer = extendedColorComputer;
}
@Override
public void mouseClicked(MouseEvent e) {
int x = e.getX();
int y = e.getY();
int colorIndex = x / (boxSize + boxGap);
int colorX = colorIndex * (boxSize + boxGap);
int extendedIndex = y / boxSize;
int extendedY = extendedIndex * boxSize;
if (colorX <= x && x <= colorX + boxSize && extendedY <= y && y <= extendedY + boxSize) {
selectedColorIndex = colorIndex;
selectedExtendedIndex = extendedIndex;
} else {
selectedColorIndex = -1;
selectedExtendedIndex = -1;
}
repaint();
}
@Override
public void mousePressed(MouseEvent e) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
@Override
public void mouseEntered(MouseEvent e) {
}
@Override
public void mouseExited(MouseEvent e) {
}
public interface ExtendedColorComputer {
Color computeExtendedColor(Color color, int index, int count);
}
@Override
public void paint(Graphics g) {
super.paint(g);
Color oldColor = g.getColor();
for (int i = 0; i < colorCount; i++) {
int x = i * (boxSize + boxGap);
for (int j = 0; j < extendedCount; j++) {
Color color = extendedColorComputer.computeExtendedColor(colorList.get(i), j, extendedCount);
g.setColor(color);
int y = j * (boxSize + boxGap);
g.fillRect(x, y, boxSize, boxSize);
}
}
g.setColor(oldColor);
}
}

6
designer-base/src/main/java/com/fr/env/detect/EnvDetectorCenter.java vendored

@ -151,7 +151,7 @@ public class EnvDetectorCenter {
if (!validAction.get()) {
return;
}
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect();
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect().stream();
// 展示效果
NotificationDialogProperties properties = new NotificationDialogProperties(DesignerContext.getDesignerFrame(), Toolkit.i18nText("Fine-Design_Basic_Detect_Notification_Title"));
@ -196,7 +196,7 @@ public class EnvDetectorCenter {
*/
public List<DetectorResult> terminate(Throwable throwable) {
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect(throwable);
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect(throwable).stream();
return resultStream
.filter((e) -> e.getStatus() == DetectorStatus.EXCEPTION)
.collect(Collectors.toList());
@ -209,7 +209,7 @@ public class EnvDetectorCenter {
*/
public List<DetectorResult> terminateUnexpectedly() {
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect();
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect().stream();
return resultStream
.filter((e) -> e.getStatus() == DetectorStatus.EXCEPTION)
.collect(Collectors.toList());

13
designer-base/src/main/java/com/fr/env/detect/base/DetectorBridge.java vendored

@ -16,7 +16,9 @@ import com.fr.log.FineLoggerFactory;
import com.fr.value.NotNullLazyValue;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
@ -128,9 +130,11 @@ public class DetectorBridge {
*
* @return 能够检测出的异常情况
*/
public Stream<DetectorResult> detect() {
@NotNull
public Collection<DetectorResult> detect() {
return detectorManager.getValue().detect();
Stream<DetectorResult> results = detectorManager.getValue().detect();
return results.collect(Collectors.toList());
}
/**
@ -141,10 +145,11 @@ public class DetectorBridge {
* @param throwable 异常
* @return 检测结果
*/
public Stream<DetectorResult> detect(Throwable throwable) {
@NotNull
public Collection<DetectorResult> detect(Throwable throwable) {
ThrowableStore.getInstance().add(throwable);
Stream<DetectorResult> result = detect();
Collection<DetectorResult> result = detect();
ThrowableStore.getInstance().reset();
return result;

5
designer-base/src/main/java/com/fr/env/detect/impl/JarLackDetector.java vendored

@ -54,6 +54,11 @@ public class JarLackDetector extends AbstractExceptionDetector {
// 本地情况
List<BuildInfo> localInfos = BuildInfoManager.getInstance().getInfos();
// 说明远程环境并不存在对应的 info.json, 直接忽略
if (Collections.isEmpty(remoteInfos)) {
return DetectorResult.normal(type());
}
Set<String> remoteSet = remoteInfos.stream()
.filter(this::isExistInfo)
.map(BuildInfo::getJar)

1
designer-base/src/main/resources/com/fr/design/config/default

@ -0,0 +1 @@
Fine-Designer_Login=i7hP48WAcuTrmxfN

2
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh.properties

@ -13,7 +13,7 @@ com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=80*20
com.fr.design.report.fit.column=100*20
com.fr.design.lock.LockInfoDialog=400*160
com.fr.design.lock.LockInfoDialog=400*180
com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24
com.fr.design.cell.expand.sort.pane=227*155
com.fr.design.sort.rule.item=80*20

2
designer-base/src/main/resources/com/fr/design/i18n/dimension_zh_TW.properties

@ -12,7 +12,7 @@ com.fr.design.actions.server.dialog=700*630
com.fr.design.report.fit.templatePane.dialog=600*400
com.fr.design.report.fit.firstColumn=80*20
com.fr.design.report.fit.column=100*20
com.fr.design.lock.LockInfoDialog=400*160
com.fr.design.lock.LockInfoDialog=400*180
com.fr.design.mainframe.ForbiddenPane.refreshButton=68*24
com.fr.design.cell.expand.sort.pane=227*155
com.fr.design.sort.rule.item=80*20

6
designer-chart/src/main/java/com/fr/design/chart/series/SeriesCondition/ColSelectedWithSummaryMethodEditor.java

@ -46,8 +46,9 @@ public class ColSelectedWithSummaryMethodEditor extends Editor<DSColumnWithSumma
}
private static void refreshComboBoxModel(String[] columnNames) {
if (columnNames != null) {
columnNameComboBoxModel.removeAllElements();
summaryMethodComboBoxModel.removeAllElements();
if (columnNames != null) {
for (String columnName : columnNames) {
columnNameComboBoxModel.addElement(columnName);
}
@ -56,9 +57,6 @@ public class ColSelectedWithSummaryMethodEditor extends Editor<DSColumnWithSumma
}
columnNameComboBoxModel.setSelectedItem(null);
summaryMethodComboBoxModel.setSelectedItem(null);
} else {
columnNameComboBoxModel.removeAllElements();
summaryMethodComboBoxModel.removeAllElements();
}
}

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

@ -7,6 +7,7 @@ import com.fr.base.chart.BaseChartCollection;
import com.fr.base.theme.FineColorFlushUtils;
import com.fr.base.theme.FineColorGather;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FineColorSynchronizer;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeAware;
@ -235,13 +236,12 @@ public class XCreatorUtils {
}
public static XCreator createThemedXCreator(Widget widget) {
XCreator creator = createXCreator(widget);
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateTheme theme = template.getTemplateTheme();
if (theme instanceof FormTheme) {
setupTemplateTheme(creator, true, (FormTheme) theme, TemplateThemeCompatible.NONE);
widget = setupTemplateTheme(widget, true, (FormTheme) theme, TemplateThemeCompatible.NONE);
}
return creator;
return createXCreator(widget);
}
/**
@ -386,14 +386,12 @@ public class XCreatorUtils {
}
public static void setupTemplateTheme(XCreator container, final boolean forceFollowingTheme, final FormTheme currentTemplateUsingTheme, TemplateThemeCompatible compatible) {
FineColorGather colorGather = new FineColorManager.FineColorReplaceByTheme(currentTemplateUsingTheme, compatible);
Widget root = container.toData();
List<BaseChartCollection> chartCollections = root.getChartCollections();
public static Widget setupTemplateTheme(Widget widget, final boolean forceFollowingTheme, final FormTheme currentTemplateUsingTheme, TemplateThemeCompatible compatible) {
List<BaseChartCollection> chartCollections = widget.getChartCollections();
for (BaseChartCollection chartCollection: chartCollections) {
chartCollection.onTemplateUsingThemeChange(currentTemplateUsingTheme, compatible);
}
Form.traversalWidget(root, new WidgetGather() {
Form.traversalWidget(widget, new WidgetGather() {
@Override
public void dealWith(Widget widget) {
TemplateThemeAware<FormTheme> themedWidget = (TemplateThemeAware) widget;
@ -408,8 +406,7 @@ public class XCreatorUtils {
return true;
}
}, TemplateThemeAware.class);
FineColorFlushUtils.replaceCacheObject(container.toData(), colorGather);
FineColorManager.traverse(container.toData(), colorGather);
return (Widget) FineColorSynchronizer.flush(widget, currentTemplateUsingTheme, compatible);
}

8
designer-form/src/main/java/com/fr/design/designer/creator/XWParameterLayout.java

@ -272,13 +272,11 @@ public class XWParameterLayout extends XWAbsoluteLayout {
}
/**
* 修改form布局的宽度时需要同时修改表单参数界面的布局的宽度
* 修改参数面板宽度
* */
@Override
public void doLayout() {
layout();
public void setParaWidth(int width) {
if (data != null && data instanceof WParameterLayout) {
((WParameterLayout) data).setDesignWidth(getWidth());
((WParameterLayout) data).setDesignWidth(width);
}
}

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

@ -12,6 +12,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
@ -402,6 +403,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
}
doReCalculateRoot(width, rec.height, layout);
}
// REPORT-66771, 调整参数面板宽度
XLayoutContainer para = FormArea.this.designer.getParaComponent();
if (para != null && para instanceof XWParameterLayout) {
((XWParameterLayout) para).setParaWidth(width);
}
}
private void reCalculateHeight(int height) {

6
designer-form/src/main/java/com/fr/design/mainframe/JForm.java

@ -6,6 +6,9 @@ import com.fr.base.Parameter;
import com.fr.base.Releasable;
import com.fr.base.extension.FileExtension;
import com.fr.base.iofile.attr.ExtendSharableAttrMark;
import com.fr.base.theme.FineColorGather;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FineColorSynchronizer;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeCompatible;
@ -661,6 +664,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
try {
Form undoForm = (Form) u.getForm().clone();
undoForm.checkAndResetTheme();
undoForm = (Form) FineColorSynchronizer.flush(undoForm, undoForm.getTemplateTheme());
if (this.index == FORM_TAB) {
//JForm的target重置
this.setTarget(undoForm);
@ -1210,6 +1214,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
protected void setUpTheme4NewTemplate() {
super.setUpTheme4NewTemplate();
getTarget().setTemplateTheme(getTarget().getTemplateTheme());
setTarget((Form) FineColorSynchronizer.flush(getTarget(), getTemplateTheme()));
}
@Override
@ -1236,6 +1241,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm<F
double slideValue = formArea.getSlideValue();
getTarget().setTemplateTheme(newTheme, compatible);
setTarget((Form) FineColorSynchronizer.flush(getTarget(), newTheme, compatible));
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState);

4
designer-form/src/main/java/com/fr/design/mainframe/share/util/ShareComponentUtils.java

@ -55,7 +55,6 @@ public class ShareComponentUtils {
}
public static XCreator createThemedXCreator(Widget creatorSource, String suitableTemplateThemeName, String shareId, SharableWidgetProvider provider) {
XCreator creator = createXCreator(creatorSource, shareId, provider);
JTemplate<?,?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
TemplateTheme theme = template.getTemplateTheme();
if (theme instanceof FormTheme) {
@ -64,8 +63,9 @@ public class ShareComponentUtils {
StringUtils.isNotEmpty(suitableTemplateThemeName) &&
StringUtils.equals(theme.getName(), suitableTemplateThemeName) &&
!StringUtils.equals(theme.getName(), themeName4LegacyTemplate);
XCreatorUtils.setupTemplateTheme(creator, false, (FormTheme) theme, isCurrentUsingThemeSuitSharedComponent ? TemplateThemeCompatible.NONE : TemplateThemeCompatible.ABSENT);
creatorSource = XCreatorUtils.setupTemplateTheme(creatorSource, false, (FormTheme) theme, isCurrentUsingThemeSuitSharedComponent ? TemplateThemeCompatible.NONE : TemplateThemeCompatible.ABSENT);
}
XCreator creator = createXCreator(creatorSource, shareId, provider);
return creator;
}

7
designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java

@ -6,6 +6,9 @@ import com.fr.base.Parameter;
import com.fr.base.ScreenResolution;
import com.fr.base.TRL;
import com.fr.base.extension.FileExtension;
import com.fr.base.theme.FineColorGather;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FineColorSynchronizer;
import com.fr.base.theme.ReportTheme;
import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeCompatible;
@ -77,6 +80,7 @@ import com.fr.file.FILEChooserPane;
import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode;
import com.fr.file.filter.ChooseFileFilter;
import com.fr.form.main.Form;
import com.fr.general.ComparatorUtils;
import com.fr.general.ModuleContext;
import com.fr.grid.Grid;
@ -790,6 +794,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
try {
WorkBook undoWorkBook = (WorkBook) u.getWorkBook().clone();
undoWorkBook.checkAndResetTheme();
undoWorkBook = (WorkBook) FineColorSynchronizer.flush(undoWorkBook, undoWorkBook.getTemplateTheme());
this.setTarget(undoWorkBook);
if (!DesignerMode.isAuthorityEditing()) {
if (u.getAuthorityType() != BaseUndoState.NORMAL_STATE) {
@ -1289,6 +1294,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
protected void setUpTheme4NewTemplate() {
super.setUpTheme4NewTemplate();
getTarget().setTemplateTheme(getTarget().getTemplateTheme());
setTarget((WorkBook) FineColorSynchronizer.flush(getTarget(), getTemplateTheme()));
}
@ -1308,6 +1314,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName());
getTarget().setTemplateTheme(newTheme, compatible);
setTarget((WorkBook) FineColorSynchronizer.flush(getTarget(), newTheme, compatible));
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
fireTargetModified(shouldCreateUndoState);

5
designer-realize/src/main/java/com/fr/design/mainframe/app/FormApp.java

@ -3,6 +3,9 @@ package com.fr.design.mainframe.app;
import com.fr.base.Parameter;
import com.fr.base.chart.exception.ChartNotFoundException;
import com.fr.base.io.XMLEncryptUtils;
import com.fr.base.theme.FineColorManager;
import com.fr.base.theme.FineColorSynchronizer;
import com.fr.base.theme.TemplateThemeCompatible;
import com.fr.design.DesignerEnvManager;
import com.fr.design.fit.NewJForm;
import com.fr.design.i18n.Toolkit;
@ -124,6 +127,6 @@ class FormApp extends AbstractAppProvider {
FineLoggerFactory.getLogger().error("Failed to generate frm from " + file, exp);
return null;
}
return tpl;
return (Form) FineColorSynchronizer.flush(tpl, tpl.getTemplateTheme());
}
}

5
designer-realize/src/main/java/com/fr/start/LifecycleFatalErrorHandler.java

@ -28,12 +28,12 @@ import com.fr.stable.lifecycle.FineLifecycleFatalError;
import com.fr.stable.project.ProjectConstants;
import javax.swing.JOptionPane;
import java.util.Collection;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author hades
@ -88,8 +88,9 @@ public class LifecycleFatalErrorHandler {
@Override
public void handle(FineLifecycleFatalError fatal) {
Stream<DetectorResult> resultStream = DetectorBridge.getInstance().detect(fatal);
Collection<DetectorResult> resultStream = DetectorBridge.getInstance().detect(fatal);
List<DetectorResult> results = resultStream
.stream()
.filter((e) -> e.getStatus() == DetectorStatus.EXCEPTION)
.collect(Collectors.toList());

6
designer-realize/src/main/java/com/fr/start/module/optimized/BaseDBActivator4Designer.java

@ -5,6 +5,8 @@ import com.fr.config.dao.DaoSelectorFactory;
import com.fr.event.Event;
import com.fr.event.Listener;
import com.fr.event.Null;
import com.fr.stable.lifecycle.FineLifecycleFatalError;
import com.fr.start.LifecycleFatalErrorHandler;
import com.fr.start.event.LazyStartupEvent;
/**
@ -20,7 +22,11 @@ public class BaseDBActivator4Designer extends BaseDBActivator {
listenEvent(LazyStartupEvent.INSTANCE, new Listener<Null>(Integer.MAX_VALUE) {
@Override
public void on(Event event, Null param) {
try {
BaseDBActivator4Designer.super.start();
} catch (FineLifecycleFatalError error) {
LifecycleFatalErrorHandler.getInstance().handle(error);
}
}
});
} else {

Loading…
Cancel
Save