Browse Source

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

* commit 'f35ba32c84abd6a96e8fe6cec1987471651771a1':
  REPORT-89007 websocket url 明文传输token -报表
  REPORT-89007 websocket url 明文传输token -报表
  REPORT-86502 SwingWorker太大了,拆一下
  REPORT-86502 设计器中增加连接失败时显示驱动加载路径与检测驱动冲突的功能
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
  Revert "KERNEL-12978 fix: 适配CBB改动"
  REPORT-89249 fix: 设计器启动FineAnalyzer需要注入Instrumentation
bugfix/11.0
superman 2 years ago
parent
commit
d49aad537c
  1. 306
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  2. 35
      designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java
  3. 26
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java
  4. 9
      designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java
  5. 10
      designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java
  6. 47
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  7. 23
      designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java
  8. 35
      designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java
  9. 42
      designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java
  10. 26
      designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java
  11. 91
      designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java
  12. 65
      designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  13. 3
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  14. 10
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java

306
designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java

@ -3,6 +3,7 @@
*/
package com.fr.design.data.datapane.connect;
import com.fr.data.driver.util.JarFileParseUtil;
import com.fr.data.impl.Connection;
import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection;
@ -32,10 +33,12 @@ import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
@ -55,6 +58,7 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.net.URI;
import java.util.concurrent.ExecutionException;
@ -93,120 +97,7 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
public void actionPerformed(ActionEvent evt) {
// Try the java connection.
final SwingWorker<Void, Void> connectionThread = new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
Connection database = DatabaseConnectionPane.this.updateBean();
// 返回连接结果
DriverPage.updateCache();
final Exception[] exception = new Exception[1];
WorkContext.getCurrent().get(DataOperatorProvider.class, new ExceptionHandler() {
@Override
public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) {
// 正常调用发生的异常也会被捕获,因此需要对异常类型进行判断,如果是NoSuchMethodException 就要去调用 testConnection
// 如果不是 NoSuchMethodException 保存下异常上下文
// 两种情况下异常都需要抛出
if (exceptionInfo.getException() instanceof NoSuchMethodException) {
if (!WorkContext.getCurrent().get(DataOperatorProvider.class).testConnection(database)) {
exception[0] = new Exception(Toolkit.i18nText("Fine-Design_Description_Of_Test_Connection"));
}
} else {
exception[0] = exceptionInfo.getException();
}
return null;
}
}).testConnectionWithException(database);
if (exception[0] != null) {
throw exception[0];
}
return null;
}
@Override
protected void done() {
try {
get();
dialog.setSize(new Dimension(380, 125));
okButton.setEnabled(true);
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
message.setText(Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully"));
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (ExecutionException e) {
dialog.setSize(new Dimension(380, 142));
midPane.setVisible(true);
hiddenPanel.setVisible(false);
okButton.setEnabled(true);
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
message.setText(Toolkit.i18nText("Fine-Design_Basic_Connection_Failed"));
Connection database = DatabaseConnectionPane.this.updateBean();
SolutionProcessor select = ExceptionSolutionSelector.get().select(e, database);
if (select instanceof ClassNotFoundExceptionSolutionProcessor) {
JPanel gridJpanel = new JPanel();
gridJpanel.setLayout(new GridLayout(5, 1, 0, 5));
UILabel driverTips = new UILabel();
driverTips.setText(Toolkit.i18nText("Fine_Designer_Not_Found_Driver"));
gridJpanel.add(driverTips);
UILabel deatail = new UILabel();
String content = Toolkit.i18nText("Fine_Designer_Not_Found") + " " + select.getResultException().getDetailMessage() + " " + Toolkit.i18nText("Fine_Designer_Driver");
deatail.setText(content);
deatail.setToolTipText(content);
gridJpanel.add(deatail);
String solution = select.getResultException().getSolution();
UILabel redirect = new UILabel();
if (solution != null) {
redirect.setText(Toolkit.i18nText("Fine_Designer_Download_Driver"));
redirect.setForeground(Color.BLUE);
redirect.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
try {
Desktop.getDesktop().browse(new URI(solution));
} catch (Exception clickException) {
FineLoggerFactory.getLogger().warn("can not open browser with {}", solution);
}
}
@Override
public void mouseEntered(MouseEvent e) {
redirect.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
@Override
public void mouseExited(MouseEvent e) {
redirect.setCursor(Cursor.getDefaultCursor());
}
});
} else {
redirect.setText(Toolkit.i18nText("Fine_Designer_Not_Found_Driver_No_Solution"));
}
gridJpanel.add(redirect);
hiddenPanel.add(gridJpanel);
gridJpanel.setBackground(Color.WHITE);
} else {
JPanel borderPanel = new JPanel();
borderPanel.setLayout(new BorderLayout());
JTextArea jta = new JTextArea();
JScrollPane jsp = new JScrollPane(jta);
jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jta.append(select.getResultException().getDetailMessage() + "\n");
jta.append(select.getResultException().getSolution());
jta.setCaretPosition(0);
jta.setEditable(false);
jta.getCaret().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
jta.getCaret().setVisible(true);
}
});
borderPanel.add(jsp, BorderLayout.CENTER);
hiddenPanel.add(borderPanel);
}
okButton.setEnabled(true);
}
}
};
final SwingWorker<Void, Void> connectionThread = new TestConnectionWorker();
midPane.setVisible(false);
hiddenPanel.setVisible(false);
initDialogPane();
@ -530,4 +421,191 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
return "JNDI";
}
}
private class TestConnectionWorker extends SwingWorker<Void, Void> {
@Override
protected Void doInBackground() throws Exception {
Connection database = DatabaseConnectionPane.this.updateBean();
// 返回连接结果
DriverPage.updateCache();
final Exception[] exception = new Exception[1];
WorkContext.getCurrent().get(DataOperatorProvider.class, new ExceptionHandler() {
@Override
public Object callHandler(RPCInvokerExceptionInfo exceptionInfo) {
// 正常调用发生的异常也会被捕获,因此需要对异常类型进行判断,如果是NoSuchMethodException 就要去调用 testConnection
// 如果不是 NoSuchMethodException 保存下异常上下文
// 两种情况下异常都需要抛出
if (exceptionInfo.getException() instanceof NoSuchMethodException) {
if (!WorkContext.getCurrent().get(DataOperatorProvider.class).testConnection(database)) {
exception[0] = new Exception(Toolkit.i18nText("Fine-Design_Description_Of_Test_Connection"));
}
} else {
exception[0] = exceptionInfo.getException();
}
return null;
}
}).testConnectionWithException(database);
if (exception[0] != null) {
throw exception[0];
}
return null;
}
@Override
protected void done() {
try {
get();
dialog.setSize(new Dimension(380, 125));
okButton.setEnabled(true);
uiLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
message.setText(Toolkit.i18nText("Fine-Design_Basic_Datasource_Connection_Successfully"));
} catch (InterruptedException e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (ExecutionException e) {
dealWithException(e);
}
}
private void dealWithException(ExecutionException e) {
dialog.setSize(new Dimension(380, 142));
midPane.setVisible(true);
hiddenPanel.setVisible(false);
okButton.setEnabled(true);
uiLabel.setIcon(UIManager.getIcon("OptionPane.errorIcon"));
message.setText(Toolkit.i18nText("Fine-Design_Basic_Connection_Failed"));
Connection database = DatabaseConnectionPane.this.updateBean();
SolutionProcessor select = ExceptionSolutionSelector.get().select(e, database);
String detail = select.getResultException().getDetailMessage();
String solution = select.getResultException().getSolution();
if (select instanceof ClassNotFoundExceptionSolutionProcessor) {
showClassNotFoundUI(select.getResultException().getDetailMessage(), select.getResultException().getSolution());
} else {
showExceptionMessageUI(detail, solution);
}
okButton.setEnabled(true);
}
private void showClassNotFoundUI(String detailMessage, String solution) {
JPanel gridJpanel = new JPanel();
gridJpanel.setLayout(new GridLayout(5, 1, 0, 5));
UILabel driverTips = new UILabel();
driverTips.setText(Toolkit.i18nText("Fine_Designer_Not_Found_Driver"));
gridJpanel.add(driverTips);
UILabel deatail = new UILabel();
String content = Toolkit.i18nText("Fine_Designer_Not_Found") + " " + detailMessage+ " " + Toolkit.i18nText("Fine_Designer_Driver");
deatail.setText(content);
deatail.setToolTipText(content);
gridJpanel.add(deatail);
UILabel redirect = new UILabel();
if (solution != null) {
redirect.setText(Toolkit.i18nText("Fine_Designer_Download_Driver"));
redirect.setForeground(Color.BLUE);
redirect.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
try {
Desktop.getDesktop().browse(new URI(solution));
} catch (Exception clickException) {
FineLoggerFactory.getLogger().warn("can not open browser with {}", solution);
}
}
@Override
public void mouseEntered(MouseEvent e) {
redirect.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
@Override
public void mouseExited(MouseEvent e) {
redirect.setCursor(Cursor.getDefaultCursor());
}
});
} else {
redirect.setText(Toolkit.i18nText("Fine_Designer_Not_Found_Driver_No_Solution"));
}
gridJpanel.add(redirect);
hiddenPanel.add(gridJpanel);
gridJpanel.setBackground(Color.WHITE);
}
private void showExceptionMessageUI(String detail, String solution) {
JPanel borderPanel = new JPanel();
borderPanel.setLayout(new BorderLayout());
JTextArea jta = new JTextArea();
JScrollPane jsp = new JScrollPane(jta);
jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
Connection con = DatabaseConnectionPane.this.updateBean();
if(con instanceof JDBCDatabaseConnection) {
String driverPath = JarFileParseUtil.getDriverClassPath((JDBCDatabaseConnection) con);
jta.append(Toolkit.i18nText("Fine_Designer_Current_Driver_Path") + ":" + driverPath + "\n");
JPanel testDriverPanel = generateTestDriverPanel((JDBCDatabaseConnection) con, driverPath);
borderPanel.add(testDriverPanel, BorderLayout.NORTH);
}
jta.append(detail + "\n");
jta.append(solution);
jta.setCaretPosition(0);
jta.setEditable(false);
jta.getCaret().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
jta.getCaret().setVisible(true);
}
});
borderPanel.add(jsp, BorderLayout.CENTER);
hiddenPanel.add(borderPanel);
}
private JPanel generateTestDriverPanel(JDBCDatabaseConnection con, String driverPath) {
JPanel xBorderPanel = new JPanel();
xBorderPanel.setLayout(new BorderLayout());
UILabel driverTestTip = new UILabel();
JLabel testResult = new JLabel();
driverTestTip.setForeground(Color.BLUE);
driverTestTip.setVisible(true);
testResult.setVisible(false);
testResult.setHorizontalAlignment(SwingConstants.CENTER);
driverTestTip.setText(Toolkit.i18nText("Fine_Designer_Driver_Path_Test"));
xBorderPanel.add(driverTestTip, BorderLayout.WEST);
xBorderPanel.add(testResult, BorderLayout.CENTER);
driverTestTip.addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent e) {
driverTestTip.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}
@Override
public void mouseExited(MouseEvent e) {
driverTestTip.setCursor(Cursor.getDefaultCursor());
}
@Override
public void mouseClicked(MouseEvent e) {
try {
String path;
if(driverPath.endsWith(JarFileParseUtil.JAR_MARKER)) {
path = new File(driverPath).getParent();
} else {
path = driverPath;
}
if(JarFileParseUtil.hasDuplicateDriver(con.getDriver(), path)) {
testResult.setForeground(Color.RED);
testResult.setText(Toolkit.i18nText("Fine_Designer_Driver_Conflict"));
} else {
testResult.setForeground(Color.BLACK);
testResult.setText(Toolkit.i18nText("Fine_Designer_Driver_No_Conflict"));
}
testResult.setVisible(true);
} catch (Exception clickException) {
FineLoggerFactory.getLogger().warn(clickException, "can not test driver conflict");
}
}
});
return xBorderPanel;
}
}
}

35
designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java

@ -0,0 +1,35 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.stable.fun.mark.Mutable;
/**
* 设计器模板主题管理-细节定制部分,支持添加tab
*
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/7
*/
public interface TemplateThemePaneProvider<T> extends Mutable {
String XML_TAG = "TemplateThemePaneProvider";
int CURRENT_LEVEL = 1;
/**
* 插入tab的位置
*
* @param total 已插入的tab数
* @return 插入位置如果想放到最后则返回-1
*/
int getInsertPosition(int total);
/**
* 获取tab对象
*
* @return tab对象
*/
BasicBeanPane<T> getTab();
}

26
designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java

@ -0,0 +1,26 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.TemplateThemePaneProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Bruce.Deng
* @version 11.0
* @see TemplateThemePaneProvider
* Created by Bruce.Deng on 2023/2/7
*/
@API(level = TemplateThemePaneProvider.CURRENT_LEVEL)
public abstract class AbstractTemplateThemePaneProvider<T> extends AbstractProvider implements TemplateThemePaneProvider<T> {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

9
designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java

@ -4,12 +4,14 @@ import com.fr.base.theme.FormTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedComponentStyle;
import com.fr.base.theme.settings.ThemedFormBodyStyle;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.theme.edit.ChartStyleFormEditPane;
import com.fr.design.mainframe.theme.edit.ComponentStyleEditPane;
import com.fr.design.mainframe.theme.edit.FormBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.FormThemePreviewPane;
import com.fr.design.mainframe.theme.processor.ThemePreviewPaneProcessor;
import javax.swing.JPanel;
@ -31,7 +33,11 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
}
@Override
public FormThemePreviewPane createThemePreviewPane() {
public TemplateThemePreviewPane<FormTheme> createThemePreviewPane() {
ThemePreviewPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(ThemePreviewPaneProcessor.XML_TAG);
if (processor != null) {
return processor.createFormThemePreviewPane();
}
return new FormThemePreviewPane();
}
@ -61,6 +67,7 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
componentStyleSettingPane = new ComponentStyleEditPane();
addCustomEditorPane(i18nText("Fine-Design_Predefined_Component_Style"), componentStyleSettingPane);
refreshExtraAdvancedPane();
}
@Override

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

@ -2,10 +2,11 @@ package com.fr.design.mainframe.theme;
import com.fr.base.theme.ReportTheme;
import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.theme.edit.ReportBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.ReportThemePreviewPane;
import javax.swing.JPanel;
import com.fr.design.mainframe.theme.processor.ThemePreviewPaneProcessor;
/**
* @author Starryi
@ -20,7 +21,11 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
}
@Override
public ReportThemePreviewPane createThemePreviewPane() {
public TemplateThemePreviewPane<ReportTheme> createThemePreviewPane() {
ThemePreviewPaneProcessor processor = ExtraDesignClassManager.getInstance().getSingle(ThemePreviewPaneProcessor.XML_TAG);
if (processor != null) {
return processor.createReportThemePreviewPane();
}
return new ReportThemePreviewPane();
}
@ -44,6 +49,7 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Template_Background"), reportBodyStyleSettingPane);
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Cell_Style"), createCellStyleSettingPane());
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Chart_Style"), createChartStyleSettingPane());
refreshExtraAdvancedPane();
}
@Override

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

@ -1,13 +1,14 @@
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;
import com.fr.base.theme.settings.ThemedColorScheme;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.fun.TemplateThemePaneProvider;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.frpane.UITabbedPane;
@ -23,6 +24,9 @@ import com.fr.design.mainframe.theme.edit.ui.LabelUtils;
import com.fr.design.mainframe.theme.ui.AutoCheckTextField;
import com.fr.design.mainframe.theme.ui.AutoCheckThemeNameTextField;
import com.fr.design.mainframe.theme.ui.BorderUtils;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
@ -34,7 +38,9 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
* @author Starryi
@ -52,6 +58,7 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
protected ColorListPane colorListPane;
protected CellStyleListEditPane cellStyleSettingPane;
protected ChartStyleEditPane chartStyleSettingPane;
protected final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
protected boolean isPopulating = false;
protected UITabbedPane uiTabbedPane;
@ -171,7 +178,7 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
uiTabbedPane = new UITabbedPane();
uiTabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 1));
container.add(uiTabbedPane, BorderLayout.CENTER);
initPluginListener();
return container;
}
@ -192,6 +199,33 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
});
uiTabbedPane.addTab(title, settingPane);
}
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
Set<TemplateThemePaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(TemplateThemePaneProvider.XML_TAG);
for (TemplateThemePaneProvider<T> provider : providers) {
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.getTab());
}
for (BasicBeanPane<T> pane : extraPaneList) {
addCustomEditorPane(pane.getTitle(), pane);
}
}
private void insertShortCut(int index, BasicBeanPane<T> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
private void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(TemplateThemePaneProvider.XML_TAG));
}
protected JPanel createCellStyleSettingPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
cellStyleSettingPane = new CellStyleListEditPane();
@ -223,6 +257,9 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
colorListPane.populate(theme.getColorScheme().getColors());
populateBean4CustomEditors(theme);
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(theme);
}
isPopulating = false;
}
@ -243,7 +280,9 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
theme.setColorScheme(colorScheme);
updateBean4CustomEditors(theme);
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(theme);
}
return theme;
}

23
designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java

@ -0,0 +1,23 @@
package com.fr.design.mainframe.theme.processor;
import com.fr.stable.fun.mark.API;
/**
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/14
*/
@API(level = ThemePreviewPaneProcessor.CURRENT_LEVEL)
public abstract class AbstractThemePreviewPaneProcessor implements ThemePreviewPaneProcessor {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public int layerIndex() {
return DEFAULT_LAYER_INDEX;
}
}

35
designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java

@ -0,0 +1,35 @@
package com.fr.design.mainframe.theme.processor;
import com.fr.base.theme.FormTheme;
import com.fr.base.theme.ReportTheme;
import com.fr.design.mainframe.theme.TemplateThemePreviewPane;
import com.fr.stable.fun.mark.Immutable;
/**
* 主题样式预览界面接口
*
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/14
*/
public interface ThemePreviewPaneProcessor extends Immutable {
String XML_TAG = "ThemePreviewPaneProcessor";
int CURRENT_LEVEL = 1;
/**
* 创建报表主题样式预览界面
*
* @return 报表主题样式预览界面
*/
TemplateThemePreviewPane<ReportTheme> createReportThemePreviewPane();
/**
* 创建决策报表主题样式预览界面
*
* @return 决策报表主题样式预览界面
*/
TemplateThemePreviewPane<FormTheme> createFormThemePreviewPane();
}

42
designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java

@ -0,0 +1,42 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.creator.XCreator;
import com.fr.stable.fun.mark.Mutable;
/**
* 设计器控件的属性设置下高级设置项扩展支持追加设置项
*
* @author Bruce.Deng
* @version 11.0
* Created by Bruce.Deng on 2023/2/15
*/
public interface WidgetAdvancedPaneProvider<T> extends Mutable {
String XML_TAG = "WidgetAdvancedPaneProvider";
int CURRENT_LEVEL = 1;
/**
* 获取插入的位置
*
* @param total 已插入的面板数
* @return 插入位置如果想放到最后则返回-1
*/
int getInsertPosition(int total);
/**
* 根据XCreator判断是否需要处理
*
* @param creator
* @return true:需要处理;false:不处理
*/
boolean accept(XCreator creator);
/**
* 创建控件高级设置项的追加面板
*
* @return 高级设置项追加面板
*/
BasicBeanPane<T> createExtraAdvancedPane();
}

26
designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java

@ -0,0 +1,26 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author Bruce.Deng
* @version 11.0
* @see WidgetAdvancedPaneProvider
* Created by Bruce.Deng on 2023/2/15
*/
@API(level = WidgetAdvancedPaneProvider.CURRENT_LEVEL)
public abstract class AbstractWidgetAdvancedPaneProvider<T> extends AbstractProvider implements WidgetAdvancedPaneProvider<T> {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

91
designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java

@ -2,6 +2,7 @@ package com.fr.design.parameter;
import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.CRPropertyDescriptor;
@ -13,6 +14,7 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.fit.common.TemplateTool;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.ParameterExpandablePaneUIProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
@ -32,6 +34,9 @@ import com.fr.design.widget.ui.designer.AbstractDataModify;
import com.fr.design.widget.ui.designer.component.UIBoundSpinner;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Background;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.report.stable.FormConstants;
import javax.swing.BorderFactory;
@ -41,6 +46,8 @@ import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/**
@ -59,6 +66,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
//是否是新设计模式下决策报表
private boolean newForm;
private PropertyGroupPane extraPropertyGroupPane;
protected final List<BasicBeanPane<WParameterLayout>> extraPaneList = new ArrayList<>();
private JPanel backgroundPane;
public RootDesignDefinePane(XCreator xCreator) {
super(xCreator);
@ -144,7 +153,6 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
fireAfterEditor.setSelected(false);
}
});
background = new AccessibleBackgroundEditor();
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png"),};
@ -152,6 +160,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left")
, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")});
backgroundPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.initExtraPane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p};
@ -159,7 +169,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), backgroundPane},
new Component[]{displayReport, null},
new Component[]{useParamsTemplate, null},
new Component[]{fireAfterEditor, null},
@ -176,6 +186,54 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
return jPanel;
}
private void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
private void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
private void refreshExtraAdvancedPane() {
extraPaneList.clear();
backgroundPane.removeAll();
Set<WidgetAdvancedPaneProvider<WParameterLayout>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<WParameterLayout> provider : providers) {
if (!provider.accept(creator)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
}
if (extraPaneList.isEmpty()) {
if (background == null) {
background = new AccessibleBackgroundEditor();
}
backgroundPane.add(background);
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
backgroundPane.add(pane);
}
}
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
public void insertShortCut(int index, BasicBeanPane<WParameterLayout> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
/**
* @param
* @Description: 获取新决策报表的AdvancePane
@ -199,8 +257,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
fireAfterEditor.setSelected(false);
}
});
background = new AccessibleBackgroundEditor();
backgroundPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.initExtraPane();
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
@ -208,7 +266,7 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), background},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")), backgroundPane},
new Component[]{displayReport, null},
new Component[]{useParamsTemplate, null},
new Component[]{fireAfterEditor, null},
@ -229,7 +287,13 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
@Override
public void populateBean(WParameterLayout ob) {
labelNameTextField.setText(ob.getLabelName());
background.setValue(ob.getBackground());
if (extraPaneList.isEmpty()) {
background.setValue(ob.getBackground());
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
pane.populateBean(ob);
}
}
displayReport.setSelected(ob.isDelayDisplayContent());
useParamsTemplate.setSelected(ob.isUseParamsTemplate());
fireAfterEditor.setEnabled(ob.isUseParamsTemplate());
@ -277,8 +341,14 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
wParameterLayout.setParamsFireStopEdit(fireAfterEditor.isSelected());
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected());
wParameterLayout.setBackground((Background) background.getValue());
wParameterLayout.setPosition((Integer) hAlignmentPane.getSelectedItem());
if (extraPaneList.isEmpty()) {
wParameterLayout.setBackground((Background) background.getValue());
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
pane.updateBean(wParameterLayout);
}
}
return wParameterLayout;
}
@ -299,6 +369,13 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected());
wParameterLayout.setBackground((Background) background.getValue());
if (extraPaneList.isEmpty()) {
background.setValue(wParameterLayout.getBackground());
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
pane.populateBean(wParameterLayout);
}
}
//设置参数模板面板的高度
int height = (int) paraHeight.getTextField().getValue();
FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign();

65
designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.design.beans.UITextFieldAdapter;
import com.fr.design.constants.LayoutConstants;
@ -12,6 +13,7 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.TextFieldAdapterProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
@ -19,7 +21,10 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FontSizeComboPane;
import com.fr.form.ui.FieldEditor;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -27,6 +32,9 @@ import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> {
protected UICheckBox allowBlankCheckBox;
@ -35,7 +43,8 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected JPanel validatePane;
protected FontSizeComboPane fontSizePane;
protected UITextField labelNameTextField;
private final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
private JPanel extraPane;
public FieldEditorDefinePane(XCreator xCreator) {
super(xCreator);
@ -49,8 +58,11 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
allowBlankCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
fontSizePane = new FontSizeComboPane();
JPanel contentPane = this.setFirstContentPane();
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(contentPane, BorderLayout.CENTER);
JPanel jPanel = FRGUIPaneFactory.createYBoxEmptyBorderPane();
jPanel.add(contentPane);
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
jPanel.add(extraPane);
this.initExtraPane();
contentPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
if (contentPane != null) {
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, jPanel);
@ -59,12 +71,35 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
this.addValidatePane();
}
private void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
private void refreshExtraAdvancedPane() {
extraPaneList.clear();
extraPane.removeAll();
Set<WidgetAdvancedPaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<T> provider : providers) {
if (!provider.accept(creator)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
}
for (BasicBeanPane<T> pane : extraPaneList) {
extraPane.add(pane);
}
}
@Override
public void populateBean(T ob) {
this.allowBlankCheckBox.setSelected(ob.isAllowBlank());
this.errorMsgTextField.setText(ob.getErrorMessage());
this.fontSizePane.setValue(ob.getFontSize());
this.labelNameTextField.setText(ob.getLabelName());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(ob);
}
populateSubFieldEditorBean(ob);
}
@ -78,6 +113,9 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
e.setErrorMessage(this.errorMsgTextField.getText());
e.setFontSize(fontSizePane.getValue());
e.setLabelName(labelNameTextField.getText());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(e);
}
return e;
}
@ -152,4 +190,25 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
return null;
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
private void insertShortCut(int index, BasicBeanPane<T> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
private void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
}

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

@ -1311,6 +1311,7 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
boolean shouldCreateUndoState = compatible == TemplateThemeCompatible.NONE && !StringUtils.equals(oldTheme.getName(), newTheme.getName());
getTarget().setTemplateTheme(newTheme, compatible);
getTarget().getReportParameterAttr().onTemplateUsingThemeChange(newTheme, compatible);
setTarget((WorkBook) FineColorSynchronizer.flush(getTarget(), newTheme, compatible));
if (HistoryTemplateListCache.getInstance().getCurrentEditingTemplate() == this) {
@ -1318,6 +1319,8 @@ public class JWorkBook extends JTemplate<WorkBook, WorkBookUndoState> {
reportComposite.setSelectedIndex(reportComposite.getSelectedIndex());
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).refreshDockingView();
DesignerContext.getDesignerFrame().resetToolkitByPlus(HistoryTemplateListPane.getInstance().getCurrentEditingTemplate());
// 刷新参数面板界面
populateReportParameterAttr();
}
super.setTemplateTheme(newTheme, compatible);

10
designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java

@ -1,6 +1,5 @@
package com.fr.design.mainframe.socketio;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants;
@ -14,6 +13,8 @@ import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo;
import com.fr.workspace.server.socket.SocketIOVerifier;
import com.fr.workspace.server.socket.SocketVerifierOperator;
import io.socket.client.IO;
import io.socket.engineio.client.transports.Polling;
import io.socket.engineio.client.transports.WebSocket;
@ -83,14 +84,17 @@ public abstract class AbstractSocketConfig {
WorkspaceConnection connection = current.getConnection();
currentProtocol = getCurrentProtocolFromUrl(url);
String[] result = new String[ports.length];
// REPORT-89007: websocket 避免url明文传输token。兼容旧版本服务器:旧版传递token,新版传递加密后的wsid
String token = connection.getToken();
SocketIOVerifier verifier = WorkContext.getCurrent().get(SocketVerifierOperator.class).getVerifier(token);
for (int i = 0; i < ports.length; i++) {
result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s",
currentProtocol,
url.getHost(),
ports[i],
WorkspaceConstants.WS_NAMESPACE,
DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME,
connection.getToken(),
verifier.getVerifierPrefix(),
verifier.getVerifierCode(),
RemoteDesignConstants.USER_LOCK_ID,
connection.getId());
}

Loading…
Cancel
Save