Browse Source

Merge pull request #5916 in DESIGN/design from release/11.0 to feature/x

* commit 'a58c0754d76b91e4454aedb213a49d63da8b6b77': (25 commits)
  REPORT-55377 升级tomcat到8.5.69
  REPORT-56220 数据连接越权漏洞修复
  REPORT-56220 数据连接越权漏洞修复
  REPORT-56220 数据连接越权漏洞修复
  REPORT-56220 数据连接越权漏洞修复
  REPORT-55377 更新Tomcat版本到8.5.69
  add executeJavaScriptAndReturnValue function
  CHART-20662 fix:数据集字段拖入单元格 白色文字
  CHART-19792 大屏模板屏蔽全局参数菜单项
  v7打开调试窗口失败的问题
  还原范围
  CHART-20642 图表预定义配色避免重名和空字符串名
  新接口
  新接口
  CHART-20402 增加几个接口
  CHART-20402 增加几个接口
  CHART-20402 增加几个接口
  ignore
  根据最新视觉调整单元格边框颜色
  POM-2302 cpt组件默认样式
  ...
research/11.0
superman 3 years ago
parent
commit
90e8ea7a66
  1. 8
      build.gradle
  2. 7
      designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java
  3. 6
      designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java
  4. 20
      designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java
  5. 20
      designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java
  6. 45
      designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java
  7. 27
      designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java
  8. 184
      designer-base/src/main/java/com/fr/design/mainframe/authority/JTemplateAuthorityChecker.java
  9. 22
      designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java
  10. 19
      designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java
  11. 11
      designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java
  12. 37
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java
  13. 2
      designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java
  14. 19
      designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java
  15. 57
      designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java
  16. 46
      designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java
  17. 8
      designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java
  18. 3
      designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java
  19. 7
      designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java
  20. 3
      designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java
  21. 6
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java
  22. 5
      designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java
  23. 2
      designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java
  24. 14
      designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java
  25. 2
      designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java
  26. 3
      designer-realize/src/main/java/com/fr/grid/Grid.java
  27. 11
      designer-realize/src/main/java/com/fr/grid/GridUI.java
  28. 3
      designer-realize/src/main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java
  29. 2
      designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java

8
build.gradle

@ -36,7 +36,7 @@ allprojects {
group 'com.fr.design' group 'com.fr.design'
version frDevVersion version frDevVersion
sourceCompatibility = languageLevelSetting sourceCompatibility = languageLevelSetting
targetCompatibility = languageLevelSetting targetCompatibility = languageLevelSetting
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.encoding = "UTF-8" options.encoding = "UTF-8"
@ -49,8 +49,8 @@ allprojects {
idea { idea {
module { module {
inheritOutputDirs = false inheritOutputDirs = false
outputDir = file(outputPath +"/classes") outputDir = file(outputPath + "/classes")
testOutputDir = file(outputPath +"/test-classes") testOutputDir = file(outputPath + "/test-classes")
languageLevel = new IdeaLanguageLevel(sourceCompatibility) languageLevel = new IdeaLanguageLevel(sourceCompatibility)
targetBytecodeVersion = targetCompatibility targetBytecodeVersion = targetCompatibility
} }
@ -68,7 +68,7 @@ allprojects {
implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swexpl:2.0.1'
implementation 'org.swingexplorer:swag:1.0' implementation 'org.swingexplorer:swag:1.0'
implementation 'net.java.dev.jna:jna:5.4.0' implementation 'net.java.dev.jna:jna:5.4.0'
implementation 'org.apache.tomcat:tomcat-catalina:8.5.57' implementation 'org.apache.tomcat:tomcat-catalina:8.5.69'
implementation 'io.socket:socket.io-client:0.7.0' implementation 'io.socket:socket.io-client:0.7.0'
implementation 'com.fr.third:fine-third:' + frVersion implementation 'com.fr.third:fine-third:' + frVersion
implementation 'com.fr.core:fine-core:' + frDevVersion implementation 'com.fr.core:fine-core:' + frDevVersion

7
designer-base/src/main/java/com/fr/design/gui/itextfield/EditTextField.java

@ -1,12 +1,11 @@
package com.fr.design.gui.itextfield; package com.fr.design.gui.itextfield;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import javax.swing.text.AttributeSet; import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument; import javax.swing.text.PlainDocument;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
/** /**

6
designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.extension.FileExtension; import com.fr.base.extension.FileExtension;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.chartx.TwoTuple;
import com.fr.design.DesignModelAdapter; import com.fr.design.DesignModelAdapter;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
@ -35,6 +36,8 @@ import com.fr.design.menu.ToolBarDef;
import com.fr.design.roleAuthority.RolesAlreadyEditedPane; import com.fr.design.roleAuthority.RolesAlreadyEditedPane;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.file.FileNodeFILE; import com.fr.file.FileNodeFILE;
import com.fr.file.filetree.FileNode; import com.fr.file.filetree.FileNode;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -78,6 +81,8 @@ import java.util.Set;
import static javax.swing.JOptionPane.WARNING_MESSAGE; import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange { public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarStateChangeListener, ResponseDataSourceChange {
public static final Event<TwoTuple<String, String>> TEMPLATE_RENAME = new Event<TwoTuple<String, String>>() {
};
private static final String FILE = "file"; private static final String FILE = "file";
private static volatile DesignerFrameFileDealerPane THIS; private static volatile DesignerFrameFileDealerPane THIS;
@ -690,6 +695,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt
boolean success = selectedOperation.rename(fnf, path, newPath); boolean success = selectedOperation.rename(fnf, path, newPath);
if (success) { if (success) {
EventDispatcher.fire(TEMPLATE_RENAME, new TwoTuple<>(path, newPath));
HistoryTemplateListCache.getInstance().rename(fnf, path, newPath); HistoryTemplateListCache.getInstance().rename(fnf, path, newPath);
DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(fnf.isDirectory(), path, newPath); DesignerEnvManager.getEnvManager().replaceRecentOpenedFilePath(fnf.isDirectory(), path, newPath);
selectedOperation.refresh(); selectedOperation.refresh();

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

@ -43,6 +43,7 @@ import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIMenuItem;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.authority.JTemplateAuthorityChecker;
import com.fr.design.mainframe.chart.info.ChartInfoCollector; import com.fr.design.mainframe.chart.info.ChartInfoCollector;
import com.fr.design.mainframe.check.CheckButton; import com.fr.design.mainframe.check.CheckButton;
import com.fr.design.mainframe.template.info.TemplateProcessInfo; import com.fr.design.mainframe.template.info.TemplateProcessInfo;
@ -252,6 +253,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
} }
} }
private void stopListenThemeConfig() { private void stopListenThemeConfig() {
if (themeConfigChangeListener != null) { if (themeConfigChangeListener != null) {
TemplateThemeConfig<? extends TemplateTheme> config = getUsingTemplateThemeConfig(); TemplateThemeConfig<? extends TemplateTheme> config = getUsingTemplateThemeConfig();
@ -1409,7 +1411,7 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
* @return 按钮组 * @return 按钮组
*/ */
public UIButton[] createExtraButtons() { public UIButton[] createExtraButtons() {
UIButton[] uiButtons = new UIButton[] { UIButton[] uiButtons = new UIButton[]{
(UIButton) new CompileAction().createToolBarComponent() (UIButton) new CompileAction().createToolBarComponent()
}; };
Set<DesignerFrameUpButtonProvider> providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG); Set<DesignerFrameUpButtonProvider> providers = ExtraDesignClassManager.getInstance().getArray(DesignerFrameUpButtonProvider.XML_TAG);
@ -1576,13 +1578,19 @@ public abstract class JTemplate<T extends BaseBook, U extends BaseUndoState<?>>
} }
private boolean saveRealFile() throws Exception { private boolean saveRealFile() throws Exception {
FILE editingFILE = this.getEditingFILE(); JTemplateAuthorityChecker jTemplateAuthorityChecker = new JTemplateAuthorityChecker(this);
if (editingFILE == null || editingFILE instanceof MemFILE) { if (jTemplateAuthorityChecker.isAuthority()) {
FILE editingFILE = this.getEditingFILE();
if (editingFILE == null || editingFILE instanceof MemFILE) {
return false;
}
this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE));
this.editingFILE = editingFILE;
return true;
} else {
jTemplateAuthorityChecker.showAuthorityFailPromptDialog();
return false; return false;
} }
this.getTarget().export(TemplateResourceManager.getResource().saveTemplate(editingFILE));
this.editingFILE = editingFILE;
return true;
} }
private CallbackSaveWorker saveAs(boolean showLoc) { private CallbackSaveWorker saveAs(boolean showLoc) {

20
designer-base/src/main/java/com/fr/design/mainframe/authority/DSColumnAuthorityChecker.java

@ -0,0 +1,20 @@
package com.fr.design.mainframe.authority;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class DSColumnAuthorityChecker extends ElementAuthorityChecker<DSColumn> {
@Override
@Nullable
Set<String> getNoAuthDatasetNames(DSColumn dsColumn, Set<String> authDatasetNames) {
if (!authDatasetNames.contains(dsColumn.getDSName())) {
return new HashSet<>(Arrays.asList(dsColumn.getDSName()));
}
return null;
}
}

45
designer-base/src/main/java/com/fr/design/mainframe/authority/ElementAuthorityChecker.java

@ -0,0 +1,45 @@
package com.fr.design.mainframe.authority;
import org.jetbrains.annotations.Nullable;
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
import java.lang.reflect.Type;
import java.util.Set;
public abstract class ElementAuthorityChecker<T> {
/**
* @Description 获取越权的数据连接
* @param: t 待检查的对象
* @param: authConnectionNames 有权限的数据连接名
* @return 如果有返回名称没有返回null
*/
@Nullable
Set<String> getNoAuthConnectionNames(T t, Set<String> authConnectionNames) {
return null;
}
/**
* @Description 获取越权的服务器数据集
* @param: t 待检查的对象
* @param: authDatasetNames 有权限的服务器数据集名
* @return 如果有返回名称没有返回null
*/
@Nullable
Set<String> getNoAuthDatasetNames(T t, Set<String> authDatasetNames) {
return null;
}
/**
* @Description 要检查对象的className
* @return className
*/
String getCheckClassName() {
ParameterizedTypeImpl parameterizedType = (ParameterizedTypeImpl) this.getClass().getGenericSuperclass();
Type type = parameterizedType.getActualTypeArguments()[0];
return type.getTypeName();
}
}

27
designer-base/src/main/java/com/fr/design/mainframe/authority/FormulaAuthorityChecker.java

@ -0,0 +1,27 @@
package com.fr.design.mainframe.authority;
import com.fr.base.Formula;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class FormulaAuthorityChecker extends ElementAuthorityChecker<Formula> {
private static final Pattern FORMULA_PATTERN = Pattern.compile("^=SQL\\(\"(.+?)\",");
@Override
@Nullable
public Set<String> getNoAuthConnectionNames(Formula formula, Set<String> authConnectionNames) {
String content = formula.getContent();
Matcher matcher = FORMULA_PATTERN.matcher(content);
if (matcher.find()) {
if (!authConnectionNames.contains(matcher.group(1))) {
return new HashSet<>(Arrays.asList(matcher.group(1)));
}
}
return null;
}
}

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

@ -0,0 +1,184 @@
package com.fr.design.mainframe.authority;
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.invoke.ClassHelper;
import com.fr.log.FineLoggerFactory;
import com.fr.rpc.ExceptionHandler;
import com.fr.rpc.RPCInvokerExceptionInfo;
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.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
public class JTemplateAuthorityChecker {
JTemplate<?, ?> jTemplate;
Set<String> authConnectionNames;
Set<String> authDatasetNames;
Map<String, ElementAuthorityChecker> checkerMap = new HashMap<>();
Set<String> authFailConnectionNames = new HashSet<>();
Set<String> authFailDatasetNames = new HashSet<>();
public JTemplateAuthorityChecker(JTemplate<?, ?> jTemplate) {
long s = System.currentTimeMillis();
this.jTemplate = jTemplate;
this.initAuthNames();
this.initChecker();
FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker init time consume:" + (System.currentTimeMillis() - s));
}
private void initAuthNames() {
UserAuthority templateAuthority = WorkContext.getCurrent().get(UserAuthority.class);
Map<String, Set<String>> authNamesMap = templateAuthority.getAuthServerDataSetAndConnectionNames();
if (authNamesMap != null) {
//有权限的数据连接名称
authConnectionNames = authNamesMap.get(UserAuthority.AUTH_CONNECTION_NAMES);
//有权限的数据集名称(模板数据集和服务器数据集)
authDatasetNames = authNamesMap.get(UserAuthority.AUTH_SERVER_DATASET_NAMES);
Iterator<String> iterator = jTemplate.getTarget().getTableDataNameIterator();
while (iterator.hasNext()) {
String datasetName = iterator.next();
authDatasetNames.add(datasetName);
}
}
}
private void initChecker() {
registerChecker(new NameDatabaseConnectionAuthorityChecker());
registerChecker(new DSColumnAuthorityChecker());
registerChecker(new FormulaAuthorityChecker());
registerChecker(new NameTableDataAuthorityChecker());
}
private void registerChecker(ElementAuthorityChecker checker) {
checkerMap.put(checker.getCheckClassName(), checker);
}
public boolean isAuthority() {
long s = System.currentTimeMillis();
//遍历模板对象,根据checkerMap.keySet()把感兴趣的对象找出来
Map<String, Collection<Object>> targetObjects = ClassHelper.searchObject(jTemplate.getTarget(), checkerMap.keySet(), ClassFilter.getInstance());
//找到对应的checker,对对象进行检查
for (String name : targetObjects.keySet()) {
ElementAuthorityChecker checker = checkerMap.get(name);
for (Object object : targetObjects.get(name)) {
if (authConnectionNames != null) {
Set<String> noAuthName = checker.getNoAuthConnectionNames(object, authConnectionNames);
if (noAuthName != null) {
authFailConnectionNames.addAll(noAuthName);
}
}
if (authDatasetNames != null) {
Set<String> noAuthName = checker.getNoAuthDatasetNames(object, authDatasetNames);
if (noAuthName != null) {
authFailDatasetNames.addAll(noAuthName);
}
}
}
}
FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s));
return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0;
}
public void showAuthorityFailPromptDialog() {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(Toolkit.i18nText("Fine-Design-Basic_Save_Failure"));
stringBuffer.append("\n");
stringBuffer.append(getPromptInfo(authFailDatasetNames,
Toolkit.i18nText("Fine-Design_Template_Authority_Check_Server_Dataset_Authority")));
stringBuffer.append(getPromptInfo(authFailConnectionNames,
Toolkit.i18nText("Fine-Design_Template_Authority_Check_Data_Connection_Authority")));
FineJOptionPane.showMessageDialog(
DesignerContext.getDesignerFrame(),
stringBuffer.toString(),
Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE);
}
private String getPromptInfo(Set<String> authFailNames, String message) {
StringBuffer stringBuffer = new StringBuffer();
if (authFailNames.size() > 0) {
stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Current_Operator_Miss"));
stringBuffer.append(authFailNames.size());
stringBuffer.append(Toolkit.i18nText("Fine-Design_Report_Ge"));
stringBuffer.append(message);
stringBuffer.append("\n");
stringBuffer.append(getNoAuthNameSequence(authFailNames));
}
return stringBuffer.toString();
}
private String getNoAuthNameSequence(Set<String> names) {
StringBuffer stringBuffer = new StringBuffer();
int showMaxCount = 3;
int count = 0;
for (String name : names) {
if (count == showMaxCount) {
stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Etc"));
break;
}
stringBuffer.append(name);
if (count != names.size() - 1 && count != showMaxCount - 1) {
stringBuffer.append(";");
}
count++;
}
stringBuffer.append("\n");
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;
}
}
}

22
designer-base/src/main/java/com/fr/design/mainframe/authority/NameDatabaseConnectionAuthorityChecker.java

@ -0,0 +1,22 @@
package com.fr.design.mainframe.authority;
import com.fr.data.impl.NameDatabaseConnection;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
public class NameDatabaseConnectionAuthorityChecker extends ElementAuthorityChecker<NameDatabaseConnection> {
@Override
@Nullable
Set<String> getNoAuthConnectionNames(NameDatabaseConnection nameDatabaseConnection, Set<String> authConnectionNames) {
String name = nameDatabaseConnection.getName();
if (!authConnectionNames.contains(name)) {
return new HashSet<>(Arrays.asList(name));
}
return null;
}
}

19
designer-base/src/main/java/com/fr/design/mainframe/authority/NameTableDataAuthorityChecker.java

@ -0,0 +1,19 @@
package com.fr.design.mainframe.authority;
import com.fr.data.impl.NameTableData;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class NameTableDataAuthorityChecker extends ElementAuthorityChecker<NameTableData> {
@Override
@Nullable
Set<String> getNoAuthDatasetNames(NameTableData nameTableData, Set<String> authDatasetNames) {
if (!authDatasetNames.contains(nameTableData.getName())) {
return new HashSet<>(Arrays.asList(nameTableData.getName()));
}
return null;
}
}

11
designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -40,6 +40,7 @@ import com.fr.design.actions.server.GlobalParameterAction;
import com.fr.design.actions.server.GlobalTableDataAction; import com.fr.design.actions.server.GlobalTableDataAction;
import com.fr.design.actions.server.PlatformManagerAction; import com.fr.design.actions.server.PlatformManagerAction;
import com.fr.design.actions.server.PluginManagerAction; import com.fr.design.actions.server.PluginManagerAction;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.file.NewTemplatePane; import com.fr.design.file.NewTemplatePane;
import com.fr.design.fun.MenuHandler; import com.fr.design.fun.MenuHandler;
import com.fr.design.fun.OemProcessor; import com.fr.design.fun.OemProcessor;
@ -491,10 +492,12 @@ public abstract class ToolBarMenuDock {
if (!DesignerMode.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
addPluginManagerAction(menuDef); addPluginManagerAction(menuDef);
menuDef.addShortCut( menuDef.addShortCut(new FunctionManagerAction());
new FunctionManagerAction(),
new GlobalParameterAction() if (!DesignModeContext.isDuchampMode()) {
); menuDef.addShortCut(new GlobalParameterAction());
}
} }

37
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -17,15 +17,16 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.chromium.swing.BrowserView; import com.teamdev.jxbrowser.chromium.swing.BrowserView;
import com.teamdev.jxbrowser.event.Observer;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import java.util.Map;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.Map;
/** /**
* @author richie * @author richie
@ -157,6 +158,34 @@ public class ModernUIPane<T> extends BasicPane {
return null; return null;
} }
public void disposeBrowser() {
if(browser != null) {
browser.dispose();
browser = null;
}
}
public void clearCache() {
if (browser != null) {
browser.getCacheStorage().clearCache();
}
}
public void executeJavaScript(String javaScript) {
if (browser != null) {
browser.executeJavaScript(javaScript);
}
}
public JSValue executeJavaScriptAndReturnValue(String javaScript) {
if (browser != null) {
return browser.executeJavaScriptAndReturnValue(javaScript);
}
return null;
}
public static class Builder<T> implements BuilderDiff<T> { public static class Builder<T> implements BuilderDiff<T> {
private ModernUIPane<T> pane; private ModernUIPane<T> pane;
@ -293,6 +322,12 @@ public class ModernUIPane<T> extends BasicPane {
return this; return this;
} }
@Override
public Builder<T> prepareForV7(Class event, Observer listener) {
// do nothing
return this;
}
public ModernUIPane<T> build() { public ModernUIPane<T> build() {
return pane; return pane;
} }

2
designer-base/src/main/java/com/fr/design/ui/compatible/BuilderDiff.java

@ -4,6 +4,7 @@ import com.fr.design.ui.ModernUIPane;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback; import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import com.teamdev.jxbrowser.chromium.events.LoadListener; import com.teamdev.jxbrowser.chromium.events.LoadListener;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.event.Observer;
/** /**
* 封装jxbrwoser v6/v7的构建方式的差异 * 封装jxbrwoser v6/v7的构建方式的差异
@ -20,5 +21,6 @@ public interface BuilderDiff<T> {
ModernUIPane.Builder<T> prepareForV7(InjectJsCallback callback); ModernUIPane.Builder<T> prepareForV7(InjectJsCallback callback);
ModernUIPane.Builder<T> prepareForV7(Class event, Observer listener);
} }

19
designer-base/src/main/java/com/fr/design/ui/compatible/ModernUIPaneFactory.java

@ -11,6 +11,17 @@ import com.fr.stable.os.OperatingSystem;
public class ModernUIPaneFactory { public class ModernUIPaneFactory {
public static <T> ModernUIPane.Builder<T> modernUIPaneBuilder() { public static <T> ModernUIPane.Builder<T> modernUIPaneBuilder() {
if (isV7()) {
return new NewModernUIPane.Builder<>();
} else {
return new ModernUIPane.Builder<>();
}
}
public static boolean isV7() {
// 7.15的class不存在时 走老版本 // 7.15的class不存在时 走老版本
boolean hasJxBrowserV7_15 = true; boolean hasJxBrowserV7_15 = true;
try { try {
@ -18,10 +29,8 @@ public class ModernUIPaneFactory {
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
hasJxBrowserV7_15 = false; hasJxBrowserV7_15 = false;
} }
if (OperatingSystem.isWindows() && hasJxBrowserV7_15) {
return new NewModernUIPane.Builder<>(); return OperatingSystem.isWindows() && hasJxBrowserV7_15;
} else {
return new ModernUIPane.Builder<>();
}
} }
} }

57
designer-base/src/main/java/com/fr/design/ui/compatible/NewModernUIPane.java

@ -15,6 +15,7 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.engine.Engine; import com.teamdev.jxbrowser.engine.Engine;
import com.teamdev.jxbrowser.engine.EngineOptions; import com.teamdev.jxbrowser.engine.EngineOptions;
import com.teamdev.jxbrowser.engine.RenderingMode; import com.teamdev.jxbrowser.engine.RenderingMode;
import com.teamdev.jxbrowser.event.Observer;
import com.teamdev.jxbrowser.js.JsObject; import com.teamdev.jxbrowser.js.JsObject;
import com.teamdev.jxbrowser.net.Scheme; import com.teamdev.jxbrowser.net.Scheme;
import com.teamdev.jxbrowser.view.swing.BrowserView; import com.teamdev.jxbrowser.view.swing.BrowserView;
@ -80,30 +81,33 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
private void showDebuggerDialog() { private void showDebuggerDialog() {
JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this)); JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this));
Engine engine = Engine.newInstance(
EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED) Browser debugger = browser.engine().newBrowser();
.addSwitch("--disable-google-traffic")
.remoteDebuggingPort(9222).build());
Browser debugger = engine.newBrowser();
BrowserView debuggerView = BrowserView.newInstance(debugger); BrowserView debuggerView = BrowserView.newInstance(debugger);
dialog.add(debuggerView, BorderLayout.CENTER); dialog.add(debuggerView, BorderLayout.CENTER);
dialog.setSize(new Dimension(800, 400)); dialog.setSize(new Dimension(800, 400));
GUICoreUtils.centerWindow(dialog); GUICoreUtils.centerWindow(dialog);
dialog.setVisible(true); dialog.setVisible(true);
dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
browser.devTools().remoteDebuggingUrl().ifPresent(url -> { browser.devTools().remoteDebuggingUrl().ifPresent(url -> {
debugger.navigation().loadUrl(url); debugger.navigation().loadUrl(url);
}); });
} }
private void initializeBrowser() { private void initializeBrowser() {
EngineOptions options; EngineOptions.Builder builder;
if (scheme != null && requestCallback != null) { if (scheme != null && requestCallback != null) {
options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").addScheme(scheme, requestCallback).build(); builder = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").addScheme(scheme, requestCallback);
} else { } else {
options = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic").build(); builder = EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED).addSwitch("--disable-google-traffic");
}
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
builder.remoteDebuggingPort(9222);
} }
Engine engine = Engine.newInstance(options);
Engine engine = Engine.newInstance(builder.build());
browser = engine.newBrowser(); browser = engine.newBrowser();
// 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的 // 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的
@ -161,6 +165,29 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
return null; return null;
} }
public void disposeBrowser() {
if (browser != null) {
browser.close();
browser = null;
}
}
public void clearCache() {
if (browser != null) {
browser.engine().httpCache().clear();
}
}
public void executeJavaScript(String javaScript) {
if (browser != null) {
browser.mainFrame().ifPresent(frame -> {
frame.executeJavaScript(javaScript);
});
}
}
public static class Builder<T> extends ModernUIPane.Builder<T> { public static class Builder<T> extends ModernUIPane.Builder<T> {
private NewModernUIPane<T> pane = new NewModernUIPane<>(); private NewModernUIPane<T> pane = new NewModernUIPane<>();
@ -191,7 +218,7 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
@Override @Override
public NewModernUIPane.Builder<T> withURL(final String url) { public NewModernUIPane.Builder<T> withURL(final String url) {
pane.scheme = Scheme.of("file"); pane.scheme = Scheme.of("file");
pane.requestCallback = new NxComplexInterceptRequestCallback(null); pane.requestCallback = new NxComplexInterceptRequestCallback(null);
pane.browser.navigation().loadUrl(url); pane.browser.navigation().loadUrl(url);
return this; return this;
} }
@ -301,6 +328,14 @@ public class NewModernUIPane<T> extends ModernUIPane<T> {
return prepare(callback); return prepare(callback);
} }
@Override
public ModernUIPane.Builder<T> prepareForV7(Class event, Observer listener) {
pane.browser.navigation().on(event, listener);
return this;
}
@Override @Override
public NewModernUIPane<T> build() { public NewModernUIPane<T> build() {
return pane; return pane;

46
designer-base/src/main/java/com/fr/design/utils/gui/AdjustWorkBookDefaultStyleUtils.java

@ -0,0 +1,46 @@
package com.fr.design.utils.gui;
import com.fr.base.Style;
import com.fr.base.background.ColorBackground;
import com.fr.design.base.mode.DesignModeContext;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import java.awt.Color;
/**
* @author shine
* @version 10.0
* Created by shine on 2021/9/6
*/
public class AdjustWorkBookDefaultStyleUtils {
private static final Color TEMPLATE_BACKGROUND = new Color(16, 11, 43);
private static final Color CELL_ELEMENT_BORDER = new Color(110, 110, 110);
public static void adjustCellElement(CellElement cellElement) {
if (DesignModeContext.isDuchampMode()) {
Style style = cellElement.getStyle();
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE));
style = style.deriveBorder(0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER,
0, CELL_ELEMENT_BORDER);
cellElement.setStyle(style);
}
}
public static void adjustFloatElement(FloatElement floatElement) {
if (DesignModeContext.isDuchampMode()) {
Style style = floatElement.getStyle();
style = style.deriveBackground(ColorBackground.getInstance(TEMPLATE_BACKGROUND));
style = style.deriveFRFont(style.getFRFont().applyForeground(Color.WHITE));
floatElement.setStyle(style);
}
}
public static Color adjustBack(Color color) {
return DesignModeContext.isDuchampMode() ? TEMPLATE_BACKGROUND : color;
}
}

8
designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java

@ -38,7 +38,6 @@ import com.fr.stable.Constants;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.Container;
import javax.swing.AbstractButton; import javax.swing.AbstractButton;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -67,10 +66,13 @@ import javax.swing.tree.TreePath;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Font; import java.awt.Font;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.GridLayout; import java.awt.GridLayout;
import java.awt.Image; import java.awt.Image;
import java.awt.Point; import java.awt.Point;
@ -82,8 +84,6 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver; import java.awt.image.ImageObserver;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -176,7 +176,7 @@ public final class GUICoreUtils {
if (style.getBackground() instanceof ColorBackground) { if (style.getBackground() instanceof ColorBackground) {
textField.setBackground(((ColorBackground) style.getBackground()).getColor()); textField.setBackground(((ColorBackground) style.getBackground()).getColor());
} else { } else {
textField.setBackground(Color.WHITE); textField.setBackground(AdjustWorkBookDefaultStyleUtils.adjustBack(Color.WHITE));
} }
} }

3
designer-chart/src/main/java/com/fr/van/chart/custom/other/VanChartCustomInteractivePane.java

@ -44,6 +44,9 @@ public class VanChartCustomInteractivePane extends VanChartInteractivePane {
@Override @Override
protected void updateHyperlink(Plot plot){ protected void updateHyperlink(Plot plot){
if (hyperlinkPane == null) {
return;
}
hyperlinkPane.updateBean(chart); hyperlinkPane.updateBean(chart);
} }

7
designer-chart/src/main/java/com/fr/van/chart/designer/other/VanChartInteractivePane.java

@ -685,7 +685,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
} }
protected void updateHyperlink(Plot plot) { protected void updateHyperlink(Plot plot) {
superLink.update(plot); if (superLink != null) {
superLink.update(plot);
}
} }
private void updateChartTools(VanChart chart) { private void updateChartTools(VanChart chart) {
@ -734,6 +736,9 @@ public class VanChartInteractivePane extends AbstractVanChartScrollPane<Chart> {
private void updateAutoRefresh(VanChart chart) { private void updateAutoRefresh(VanChart chart) {
if (autoRefreshPane == null) {
return;
}
RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel(); RefreshMoreLabel refreshMoreLabel = chart.getRefreshMoreLabel();
if (refreshMoreLabel == null) { if (refreshMoreLabel == null) {

3
designer-chart/src/main/java/com/fr/van/chart/map/designer/other/VanChartMapInteractivePane.java

@ -35,6 +35,9 @@ public class VanChartMapInteractivePane extends VanChartInteractivePaneWithMapZo
@Override @Override
protected void updateHyperlink(Plot plot) { protected void updateHyperlink(Plot plot) {
if (hyperlinkPane == null) {
return;
}
hyperlinkPane.updateBean(plot); hyperlinkPane.updateBean(plot);
} }

6
designer-realize/src/main/java/com/fr/design/actions/insert/flot/FormulaFloatAction.java

@ -5,7 +5,6 @@ package com.fr.design.actions.insert.flot;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.DynamicUnitList; import com.fr.base.DynamicUnitList;
import com.fr.design.actions.ElementCaseAction; import com.fr.design.actions.ElementCaseAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -16,7 +15,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement; import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
@ -24,7 +23,7 @@ import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.KeyStroke;
/** /**
* Insert formula. * Insert formula.
@ -101,6 +100,7 @@ public class FormulaFloatAction extends ElementCaseAction {
reportPane.stopEditing(); reportPane.stopEditing();
final FloatElement floatElement = DefaultThemedFloatElement.createInstance(); final FloatElement floatElement = DefaultThemedFloatElement.createInstance();
AdjustWorkBookDefaultStyleUtils.adjustFloatElement(floatElement);
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(BaseFormula.createFormulaBuilder().build()); formulaPane.populate(BaseFormula.createFormulaBuilder().build());

5
designer-realize/src/main/java/com/fr/design/actions/insert/flot/TextBoxFloatAction.java

@ -8,7 +8,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement; import com.fr.design.mainframe.theme.utils.DefaultThemedFloatElement;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.grid.Grid; import com.fr.grid.Grid;
import com.fr.grid.selection.FloatSelection; import com.fr.grid.selection.FloatSelection;
import com.fr.report.ReportHelper; import com.fr.report.ReportHelper;
@ -16,7 +16,7 @@ import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import javax.swing.*; import javax.swing.KeyStroke;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
/** /**
@ -61,6 +61,7 @@ public class TextBoxFloatAction extends AbstractShapeAction {
return; return;
} }
FloatElement floatElement = DefaultThemedFloatElement.createInstance("Text"); FloatElement floatElement = DefaultThemedFloatElement.createInstance("Text");
AdjustWorkBookDefaultStyleUtils.adjustFloatElement(floatElement);
this.startDraw(floatElement); this.startDraw(floatElement);
doWithDrawingFloatElement(); doWithDrawingFloatElement();
} }

2
designer-realize/src/main/java/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -3,6 +3,7 @@ package com.fr.design.mainframe;
import com.fr.design.actions.utils.ReportActionUtils; import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.design.widget.WidgetPane; import com.fr.design.widget.WidgetPane;
import com.fr.form.ui.NoneWidget; import com.fr.form.ui.NoneWidget;
@ -89,6 +90,7 @@ public class CellWidgetPropertyPane extends BasicPane {
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) { if (editCellElement == null) {
editCellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow()); editCellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editCellElement);
} }
this.cellElement = editCellElement; this.cellElement = editCellElement;
this.populate(editCellElement); this.populate(editCellElement);

14
designer-realize/src/main/java/com/fr/design/mainframe/cell/CellElementEditPane.java

@ -7,9 +7,15 @@ import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
import com.fr.design.gui.itabpane.TitleChangeListener; import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.cell.settingpane.AbstractCellAttrPane;
import com.fr.design.mainframe.cell.settingpane.CellExpandAttrPane;
import com.fr.design.mainframe.cell.settingpane.CellOtherSetPane;
import com.fr.design.mainframe.cell.settingpane.CellPresentPane;
import com.fr.design.mainframe.cell.settingpane.CellStylePane;
import com.fr.design.mainframe.cell.settingpane.*; import com.fr.design.mainframe.cell.settingpane.*;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.design.utils.DesignUtils; import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
@ -17,8 +23,11 @@ import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import com.fr.report.elementcase.TemplateElementCase; import com.fr.report.elementcase.TemplateElementCase;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Dimension;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -112,6 +121,7 @@ public class CellElementEditPane extends BasicPane {
CellElement cellElement = elementCase.getCellElement(cs.getColumn(), cs.getRow()); CellElement cellElement = elementCase.getCellElement(cs.getColumn(), cs.getRow());
if (cellElement == null) { if (cellElement == null) {
cellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow()); cellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(cellElement);
//默认选中的是A1单元格,所以若是A1单元格没有加到列表时要加上,否则在聚合报表时会出错 //默认选中的是A1单元格,所以若是A1单元格没有加到列表时要加上,否则在聚合报表时会出错
if (cs.isSelectedOneCell(elementCasePane) && (cs.getColumn() + cs.getRow() == 0)) { if (cs.isSelectedOneCell(elementCasePane) && (cs.getColumn() + cs.getRow() == 0)) {
elementCase.addCellElement((TemplateCellElement) cellElement); elementCase.addCellElement((TemplateCellElement) cellElement);

2
designer-realize/src/main/java/com/fr/design/present/ConditionAttributesGroupPane.java

@ -7,6 +7,7 @@ import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.controlpane.UIListControlPane; import com.fr.design.gui.controlpane.UIListControlPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -83,6 +84,7 @@ public class ConditionAttributesGroupPane extends UIListControlPane {
editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow());
if (editCellElement == null) { if (editCellElement == null) {
editCellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow()); editCellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow());
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editCellElement);
} }
SheetUtils.calculateDefaultParent(tplEC); // 不知道这行代码的作用,怕去掉之后会出问题,先放在这里 SheetUtils.calculateDefaultParent(tplEC); // 不知道这行代码的作用,怕去掉之后会出问题,先放在这里

3
designer-realize/src/main/java/com/fr/grid/Grid.java

@ -18,6 +18,7 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.DesignOperationEvent; import com.fr.design.mainframe.DesignOperationEvent;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
@ -873,6 +874,7 @@ public class Grid extends BaseGridComponent {
// 必须保证editingCellElement不是null。 // 必须保证editingCellElement不是null。
if (editingCellElement == null) { if (editingCellElement == null) {
editingCellElement = DefaultThemedTemplateCellElementCase.createInstance(column, row); editingCellElement = DefaultThemedTemplateCellElementCase.createInstance(column, row);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editingCellElement);
} }
editorComponent = getCellEditingComp(); editorComponent = getCellEditingComp();
if (editorComponent == null) { if (editorComponent == null) {
@ -1038,6 +1040,7 @@ public class Grid extends BaseGridComponent {
if (editingCellElement == null) { if (editingCellElement == null) {
editingCellElement = DefaultThemedTemplateCellElementCase.createInstance(editingColumn, editingRow); editingCellElement = DefaultThemedTemplateCellElementCase.createInstance(editingColumn, editingRow);
tplEC.addCellElement(editingCellElement); tplEC.addCellElement(editingCellElement);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(editingCellElement);
} }
if (setValue4EditingElement(newValue)) { if (setValue4EditingElement(newValue)) {
shrinkToFit(tplEC); shrinkToFit(tplEC);

11
designer-realize/src/main/java/com/fr/grid/GridUI.java

@ -10,15 +10,14 @@ import com.fr.base.background.ColorBackground;
import com.fr.base.background.ImageFileBackground; import com.fr.base.background.ImageFileBackground;
import com.fr.base.iofile.attr.WatermarkAttr; import com.fr.base.iofile.attr.WatermarkAttr;
import com.fr.base.vcs.DesignerMode; import com.fr.base.vcs.DesignerMode;
import com.fr.design.DesignerEnvManager; import com.fr.design.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fun.ReportLengthUNITProvider;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.JTemplate;
import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.roleAuthority.ReportAndFSManagePane;
import com.fr.design.unit.UnitConvertUtil; import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.CellSelection;
@ -46,11 +45,11 @@ import com.fr.report.stable.ReportConstants;
import com.fr.report.stable.ReportSettings; import com.fr.report.stable.ReportSettings;
import com.fr.report.worksheet.FormElementCase; import com.fr.report.worksheet.FormElementCase;
import com.fr.report.worksheet.WorkSheet; import com.fr.report.worksheet.WorkSheet;
import com.fr.stable.AssistUtils;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.script.CalculatorUtils; import com.fr.stable.script.CalculatorUtils;
import com.fr.stable.unit.FU; import com.fr.stable.unit.FU;
import com.fr.stable.AssistUtils;
import com.fr.stable.unit.UNIT; import com.fr.stable.unit.UNIT;
import com.fr.third.antlr.ANTLRException; import com.fr.third.antlr.ANTLRException;
import com.fr.third.guava.collect.HashMultimap; import com.fr.third.guava.collect.HashMultimap;
@ -176,7 +175,7 @@ public class GridUI extends ComponentUI {
// denny:画背景.Background // denny:画背景.Background
Background background = reportSettings.getBackground(); Background background = reportSettings.getBackground();
if (background != null) { if (background != null && !DesignModeContext.isDuchampMode()) {
// denny: except the ColorBackground and ImageBackground // denny: except the ColorBackground and ImageBackground
if (grid.isEnabled() && !(background instanceof ImageFileBackground)) { if (grid.isEnabled() && !(background instanceof ImageFileBackground)) {
background.paint(g2d, this.back_or_selection_rect); background.paint(g2d, this.back_or_selection_rect);
@ -189,7 +188,7 @@ public class GridUI extends ComponentUI {
private void clearBackground(Graphics2D g2d, Grid grid) { private void clearBackground(Graphics2D g2d, Grid grid) {
if (grid.isEnabled()) { if (grid.isEnabled()) {
g2d.setPaint(Color.WHITE); g2d.setPaint(AdjustWorkBookDefaultStyleUtils.adjustBack(Color.WHITE));
} else { } else {
g2d.setPaint(UIManager.getColor("control")); g2d.setPaint(UIManager.getColor("control"));
} }

3
designer-realize/src/main/java/com/fr/grid/dnd/ElementCasePaneDropTarget.java

@ -5,6 +5,7 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIToggleButton; import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.utils.gui.AdjustWorkBookDefaultStyleUtils;
import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase; import com.fr.design.mainframe.theme.utils.DefaultThemedTemplateCellElementCase;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.data.TableDataColumn; import com.fr.general.data.TableDataColumn;
@ -250,7 +251,7 @@ public class ElementCasePaneDropTarget extends DropTargetAdapter {
cellExPandAttr.setDirection(Constants.TOP_TO_BOTTOM); cellExPandAttr.setDirection(Constants.TOP_TO_BOTTOM);
if (curCellElement == null) { if (curCellElement == null) {
curCellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow(), cs.getColumnSpan(), cs.getRowSpan(), newLinearDSColumn); curCellElement = DefaultThemedTemplateCellElementCase.createInstance(cs.getColumn(), cs.getRow(), cs.getColumnSpan(), cs.getRowSpan(), newLinearDSColumn);
AdjustWorkBookDefaultStyleUtils.adjustCellElement(curCellElement);
report.addCellElement(curCellElement); report.addCellElement(curCellElement);
} else { } else {
// marks:直接覆盖值 // marks:直接覆盖值

2
designer-realize/src/test/java/com/fr/design/mainframe/app/DesignerAppUtilsTest.java

@ -103,4 +103,4 @@ public class DesignerAppUtilsTest {
Assert.assertEquals(1, pluginMarkerAdapters1.size()); Assert.assertEquals(1, pluginMarkerAdapters1.size());
pluginMarkerAdapters1.contains(PluginMarker.create("com.fr.plugin5","1")); pluginMarkerAdapters1.contains(PluginMarker.create("com.fr.plugin5","1"));
} }
} }
Loading…
Cancel
Save