Browse Source

Merge pull request #11638 in DESIGN/design from final/11.0 to persist/11.0

* commit 'a0cf3fee2f91a4cfacdd4d4d5bd9ad91d2fd4a78': (33 commits)
  REPORT-91591 单元格控件的自定义样式设置
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
  REPORT-88335 模板查找替换面板国际化显示问题
  REPORT-88335 模板查找替换面板国际化显示问题
  REPORT-90800 设计器远程设计不显示驱动路径
  REPORT-67195 修改判断逻辑
  REPORT-67195 修改模版判断逻辑
  REPORT-67195 FR11决策报表-单元格超链显示“当前决策报表对象”但不显示“图表超链-联动悬浮元素”,安装个上传下载文件插件后,超链显示“图表超链-联动悬浮元素”但不显示“当前决策报表对象”了 【问题原因】此前不同面板使用的是同一个超链filter,导致若当前打开了cpt、frm模版,再安装使用了HyperlinkProvider接口的插件,刷新超链选项,所有模版的超链选项将变得完全相同 【改动思路】为不用超链面板设置不同的filter
  REPORT-87567 拖动一张模板进入设计器,鼠标右键找到左侧模板树中的位置,没有反应
  REPORT-90598 首次重启设计器新建sql server数据连接首次保存报错数据库限制 【问题原因】首次获取lic中支持的数据库类型时,枚举类未初始化,导致获取为空 【改动思路】修改接口
  REPORT-86430 AlphaFine插件中心tab页显示内容有误
  REPORT-86430 AlphaFine插件中心tab页显示内容有误
  REPORT-86430 AlphaFine插件中心tab页显示内容有误
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
  REPORT-83259 & REPORT-83263 【最强控件】控件样式跟随主题&开放自定义
  REPORT-86430 AlphaFine插件中心tab页显示内容有误
  REPORT-86430 AlphaFine插件中心tab页显示内容有误
  REPORT-86430 AlphaFine插件中心tab页显示内容有误
  ...
fix-lag
superman 2 years ago
parent
commit
afc6873d40
  1. 17
      build.gradle
  2. 9
      designer-base/src/main/java/com/fr/design/data/datapane/connect/ConnectionListPane.java
  3. 306
      designer-base/src/main/java/com/fr/design/data/datapane/connect/DatabaseConnectionPane.java
  4. 4
      designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java
  5. 35
      designer-base/src/main/java/com/fr/design/fun/TemplateThemePaneProvider.java
  6. 26
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractTemplateThemePaneProvider.java
  7. 24
      designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java
  8. 4
      designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java
  9. 2
      designer-base/src/main/java/com/fr/design/hyperlink/ReportletHyperNorthPane.java
  10. 9
      designer-base/src/main/java/com/fr/design/mainframe/theme/FormThemeProfilePane.java
  11. 10
      designer-base/src/main/java/com/fr/design/mainframe/theme/ReportThemeProfilePane.java
  12. 47
      designer-base/src/main/java/com/fr/design/mainframe/theme/TemplateThemeEditorPane.java
  13. 23
      designer-base/src/main/java/com/fr/design/mainframe/theme/processor/AbstractThemePreviewPaneProcessor.java
  14. 35
      designer-base/src/main/java/com/fr/design/mainframe/theme/processor/ThemePreviewPaneProcessor.java
  15. 25
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java
  16. 50
      designer-form/src/main/java/com/fr/design/fun/WidgetAdvancedPaneProvider.java
  17. 26
      designer-form/src/main/java/com/fr/design/fun/impl/AbstractWidgetAdvancedPaneProvider.java
  18. 13
      designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java
  19. 91
      designer-form/src/main/java/com/fr/design/parameter/RootDesignDefinePane.java
  20. 131
      designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java
  21. 83
      designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java
  22. 50
      designer-form/src/main/java/com/fr/design/widget/ui/designer/DateEditorDefinePane.java
  23. 51
      designer-form/src/main/java/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java
  24. 48
      designer-form/src/main/java/com/fr/design/widget/ui/designer/FieldEditorDefinePane.java
  25. 103
      designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java
  26. 42
      designer-form/src/main/java/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java
  27. 40
      designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java
  28. 43
      designer-form/src/main/java/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java
  29. 2
      designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java
  30. 2
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java
  31. 19
      designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java
  32. 5
      designer-realize/src/main/java/com/fr/design/mainframe/JWorkBook.java
  33. 28
      designer-realize/src/main/java/com/fr/design/mainframe/ReportHyperlinkGroupPane.java
  34. 49
      designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java
  35. 10
      designer-realize/src/main/java/com/fr/design/mainframe/socketio/AbstractSocketConfig.java

17
build.gradle

@ -1,4 +1,5 @@
import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
import org.gradle.internal.os.OperatingSystem
plugins { plugins {
id 'java' id 'java'
@ -65,11 +66,7 @@ allprojects {
implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion implementation 'com.fr.cbb:fine-universal-skeleton:' + cbbVersion
implementation 'com.install4j:install4j-runtime:8.0.4' implementation 'com.install4j:install4j-runtime:8.0.4'
implementation 'com.fr.third:jxbrowser:6.23' implementation 'com.fr.third:jxbrowser:6.23'
implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation 'com.fr.third:jxbrowser-v7:7.22' implementation 'com.fr.third:jxbrowser-v7:7.22'
implementation 'com.fr.third:jxbrowser-mac-v7:7.22'
implementation 'com.fr.third:jxbrowser-win64-v7:7.22'
implementation 'com.fr.third:jxbrowser-swing-v7:7.22' implementation 'com.fr.third:jxbrowser-swing-v7:7.22'
implementation 'com.fr.third.server:servlet-api:3.0' implementation 'com.fr.third.server:servlet-api:3.0'
implementation 'org.swingexplorer:swexpl:2.0.1' implementation 'org.swingexplorer:swexpl:2.0.1'
@ -94,4 +91,16 @@ allprojects {
testImplementation 'org.powermock:powermock-api-easymock:1.7.1' testImplementation 'org.powermock:powermock-api-easymock:1.7.1'
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
} }
if (OperatingSystem.current().isMacOsX()) {
dependencies {
implementation 'com.fr.third:jxbrowser-mac:6.23'
implementation 'com.fr.third:jxbrowser-mac-v7:7.22'
}
} else if (OperatingSystem.current().isWindows()) {
dependencies {
implementation 'com.fr.third:jxbrowser-win64:6.23'
implementation 'com.fr.third:jxbrowser-win64-v7:7.22'
}
}
} }

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

@ -21,8 +21,8 @@ import com.fr.event.EventDispatcher;
import com.fr.file.ConnectionConfig; import com.fr.file.ConnectionConfig;
import com.fr.file.ConnectionOperator; import com.fr.file.ConnectionOperator;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.license.database.BaseDataBaseTypePoint;
import com.fr.license.database.DBTypes; import com.fr.license.database.DBTypes;
import com.fr.license.database.DataBaseTypePointManager;
import com.fr.license.exception.DataBaseNotSupportedException; import com.fr.license.exception.DataBaseNotSupportedException;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -279,8 +279,7 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
Connection connection = bean.getConnection(); Connection connection = bean.getConnection();
// 仅校验jdbc连接,其他插件数据连接不进行校验 // 仅校验jdbc连接,其他插件数据连接不进行校验
if (connection instanceof JDBCDatabaseConnection) { if (connection instanceof JDBCDatabaseConnection) {
BaseDataBaseTypePoint dataBaseTypePoint = BaseDataBaseTypePoint.getDataBaseTypePoint(connection.getDriver(), connection.feature()); DBTypes dataBaseTypePoint = DataBaseTypePointManager.getInstance().getDataBaseTypePoint(connection.getDriver(), connection.feature());
if (connectionIsNotSupported(connection, dataBaseTypePoint)) { if (connectionIsNotSupported(connection, dataBaseTypePoint)) {
notSupportedConnections.addAll(dataBaseTypePoint.getDataBaseType()); notSupportedConnections.addAll(dataBaseTypePoint.getDataBaseType());
} }
@ -296,9 +295,9 @@ public class ConnectionListPane extends JListControlPane implements ConnectionSh
/** /**
* 校验当前数据连接是否被限制 * 校验当前数据连接是否被限制
*/ */
private static boolean connectionIsNotSupported(Connection connection, BaseDataBaseTypePoint dataBaseTypePoint) { private static boolean connectionIsNotSupported(Connection connection, DBTypes dataBaseTypePoint) {
return !validateFRDemo(connection.getDriver(), connection.feature()) && return !validateFRDemo(connection.getDriver(), connection.feature()) &&
(dataBaseTypePoint != null && !supportedDatabaseTypes.containsAll(dataBaseTypePoint.getDatabaseType())); (dataBaseTypePoint != null && !supportedDatabaseTypes.containsAll(dataBaseTypePoint.getDataBaseType()));
} }
/** /**

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; 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.Connection;
import com.fr.data.impl.JDBCDatabaseConnection; import com.fr.data.impl.JDBCDatabaseConnection;
import com.fr.data.impl.JNDIDatabaseConnection; import com.fr.data.impl.JNDIDatabaseConnection;
@ -32,10 +33,12 @@ import com.fr.workspace.WorkContext;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.BoxLayout; import javax.swing.BoxLayout;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.UIManager; import javax.swing.UIManager;
@ -55,6 +58,7 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.io.File;
import java.net.URI; import java.net.URI;
import java.util.concurrent.ExecutionException; 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) { public void actionPerformed(ActionEvent evt) {
// Try the java connection. // Try the java connection.
final SwingWorker<Void, Void> connectionThread = new SwingWorker<Void, Void>() { final SwingWorker<Void, Void> connectionThread = new TestConnectionWorker();
@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);
}
}
};
midPane.setVisible(false); midPane.setVisible(false);
hiddenPanel.setVisible(false); hiddenPanel.setVisible(false);
initDialogPane(); initDialogPane();
@ -530,4 +421,191 @@ public abstract class DatabaseConnectionPane<E extends com.fr.data.impl.Connecti
return "JNDI"; 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 && WorkContext.getCurrent().isLocal()) {
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;
}
}
} }

4
designer-base/src/main/java/com/fr/design/file/MultiTemplateTabPane.java

@ -24,6 +24,7 @@ import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.design.worker.WorkerManager; import com.fr.design.worker.WorkerManager;
import com.fr.design.worker.save.CallbackSaveWorker; import com.fr.design.worker.save.CallbackSaveWorker;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.file.FileNodeFILE;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
@ -282,7 +283,8 @@ public class MultiTemplateTabPane extends JComponent {
private void locateTemplate(JTemplate<?, ?> template) { private void locateTemplate(JTemplate<?, ?> template) {
FILE currentTemplate = template.getEditingFILE(); FILE currentTemplate = template.getEditingFILE();
//模板不属于当前环境,跟预览一样先提示保存,再定位模板 //模板不属于当前环境,跟预览一样先提示保存,再定位模板
if (!currentTemplate.exists()) { //如果是拖拽进来的模板单单用exist不能判断,这边参考预览的判断逻辑(browserTemplate),补充一下
if (!currentTemplate.exists() || !(currentTemplate instanceof FileNodeFILE)) {
int selVal = showConfirmDialog( int selVal = showConfirmDialog(
DesignerContext.getDesignerFrame(), DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"), Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"),

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 插入位置
*/
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();
}
}

24
designer-base/src/main/java/com/fr/design/gui/controlpane/JControlPane.java

@ -9,10 +9,16 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Filter;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.JSplitPane;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.util.Arrays;
import java.util.stream.Stream;
/** /**
* Coder: zack * Coder: zack
@ -27,6 +33,8 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
ShortCut4JControlPane[] shorts; ShortCut4JControlPane[] shorts;
NameableCreator[] creators; NameableCreator[] creators;
protected Filter<NameableCreator> creatorsFilter;
private ToolBarDef toolbarDef; private ToolBarDef toolbarDef;
UIToolbar toolBar; UIToolbar toolBar;
@ -38,6 +46,7 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
JControlPane() { JControlPane() {
this.initShortCutFactory(); this.initShortCutFactory();
this.initCreatorsFilter();
this.initComponentPane(); this.initComponentPane();
} }
@ -106,6 +115,10 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
this.checkButtonEnabled(); this.checkButtonEnabled();
} }
protected void initCreatorsFilter() {
this.creatorsFilter = nameableCreator -> true;
}
protected void initCardPane() { protected void initCardPane() {
this.controlUpdatePane = createControlUpdatePane(); this.controlUpdatePane = createControlUpdatePane();
@ -183,7 +196,12 @@ abstract class JControlPane extends BasicPane implements UnrepeatedNameHelper, S
} }
public NameableCreator[] creators() { public NameableCreator[] creators() {
return creators == null ? new NameableCreator[0] : creators; if (creators == null) {
return new NameableCreator[0];
} else {
Stream<NameableCreator> nameableCreatorStream = Arrays.stream(creators).filter(creator -> creatorsFilter.accept(creator));
return nameableCreatorStream.toArray(NameableCreator[]::new);
}
} }
/** /**

4
designer-base/src/main/java/com/fr/design/gui/controlpane/shortcutfactory/ShortCutFactory.java

@ -142,10 +142,6 @@ public class ShortCutFactory extends AbstractShortCutFactory {
private void wrapActionListener(NameableCreator[] creators) { private void wrapActionListener(NameableCreator[] creators) {
for (final NameableCreator creator : creators) { for (final NameableCreator creator : creators) {
Filter<Class<? extends JavaScript>> filter = DesignModuleFactory.getHyperlinkGroupType().getFilter();
if (!filter.accept(creator.getHyperlink())) {
continue;
}
boolean isTrue = ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Datasource-Stored_Procedure")) || boolean isTrue = ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Datasource-Stored_Procedure")) ||
ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Relation_TableData")) || ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Multi_Dimensional_Database")); ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Relation_TableData")) || ComparatorUtils.equals(creator.menuName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_DS_Multi_Dimensional_Database"));
if (isTrue) { if (isTrue) {

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

@ -342,7 +342,7 @@ public class ReportletHyperNorthPane extends AbstractHyperNorthPane<ReportletHyp
// 链接打开于 // 链接打开于
UIComboBox targetFrameComboBox = new UIComboBox(getTargetFrames()); UIComboBox targetFrameComboBox = new UIComboBox(getTargetFrames());
this.setTargetFrameComboBox(targetFrameComboBox); this.setTargetFrameComboBox(targetFrameComboBox);
targetFrameComboBox.setEditable(true); targetFrameComboBox.setEditable(false);
targetFrameComboBox.setPreferredSize(new Dimension(100, 20)); targetFrameComboBox.setPreferredSize(new Dimension(100, 20));
JPanel targetFramePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); JPanel targetFramePanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
targetFramePanel.add(targetFrameComboBox); targetFramePanel.add(targetFrameComboBox);

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.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedComponentStyle; import com.fr.base.theme.settings.ThemedComponentStyle;
import com.fr.base.theme.settings.ThemedFormBodyStyle; import com.fr.base.theme.settings.ThemedFormBodyStyle;
import com.fr.design.ExtraDesignClassManager;
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.theme.edit.ChartStyleFormEditPane; import com.fr.design.mainframe.theme.edit.ChartStyleFormEditPane;
import com.fr.design.mainframe.theme.edit.ComponentStyleEditPane; import com.fr.design.mainframe.theme.edit.ComponentStyleEditPane;
import com.fr.design.mainframe.theme.edit.FormBodyStyleEditPane; import com.fr.design.mainframe.theme.edit.FormBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.FormThemePreviewPane; import com.fr.design.mainframe.theme.preview.FormThemePreviewPane;
import com.fr.design.mainframe.theme.processor.ThemePreviewPaneProcessor;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -31,7 +33,11 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
} }
@Override @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(); return new FormThemePreviewPane();
} }
@ -61,6 +67,7 @@ public class FormThemeProfilePane extends TemplateThemeProfilePane<FormTheme> {
componentStyleSettingPane = new ComponentStyleEditPane(); componentStyleSettingPane = new ComponentStyleEditPane();
addCustomEditorPane(i18nText("Fine-Design_Predefined_Component_Style"), componentStyleSettingPane); addCustomEditorPane(i18nText("Fine-Design_Predefined_Component_Style"), componentStyleSettingPane);
refreshExtraAdvancedPane();
} }
@Override @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.ReportTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.theme.edit.ReportBodyStyleEditPane; import com.fr.design.mainframe.theme.edit.ReportBodyStyleEditPane;
import com.fr.design.mainframe.theme.preview.ReportThemePreviewPane; import com.fr.design.mainframe.theme.preview.ReportThemePreviewPane;
import javax.swing.JPanel; import com.fr.design.mainframe.theme.processor.ThemePreviewPaneProcessor;
/** /**
* @author Starryi * @author Starryi
@ -20,7 +21,11 @@ public class ReportThemeProfilePane extends TemplateThemeProfilePane<ReportTheme
} }
@Override @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(); 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_Template_Background"), reportBodyStyleSettingPane);
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Cell_Style"), createCellStyleSettingPane()); addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Cell_Style"), createCellStyleSettingPane());
addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Chart_Style"), createChartStyleSettingPane()); addCustomEditorPane(Toolkit.i18nText("Fine-Design_Predefined_Chart_Style"), createChartStyleSettingPane());
refreshExtraAdvancedPane();
} }
@Override @Override

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

@ -1,13 +1,14 @@
package com.fr.design.mainframe.theme; 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.FineColorSynchronizer;
import com.fr.base.theme.TemplateTheme; import com.fr.base.theme.TemplateTheme;
import com.fr.base.theme.TemplateThemeConfig; import com.fr.base.theme.TemplateThemeConfig;
import com.fr.base.theme.settings.ThemedCellStyleList; import com.fr.base.theme.settings.ThemedCellStyleList;
import com.fr.base.theme.settings.ThemedColorScheme; 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.designer.IntervalConstants;
import com.fr.design.fun.TemplateThemePaneProvider;
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.frpane.UITabbedPane; 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.AutoCheckTextField;
import com.fr.design.mainframe.theme.ui.AutoCheckThemeNameTextField; import com.fr.design.mainframe.theme.ui.AutoCheckThemeNameTextField;
import com.fr.design.mainframe.theme.ui.BorderUtils; 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 com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -34,7 +38,9 @@ import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* @author Starryi * @author Starryi
@ -52,6 +58,7 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
protected ColorListPane colorListPane; protected ColorListPane colorListPane;
protected CellStyleListEditPane cellStyleSettingPane; protected CellStyleListEditPane cellStyleSettingPane;
protected ChartStyleEditPane chartStyleSettingPane; protected ChartStyleEditPane chartStyleSettingPane;
protected final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
protected boolean isPopulating = false; protected boolean isPopulating = false;
protected UITabbedPane uiTabbedPane; protected UITabbedPane uiTabbedPane;
@ -171,7 +178,7 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
uiTabbedPane = new UITabbedPane(); uiTabbedPane = new UITabbedPane();
uiTabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 1)); uiTabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 5, 10, 1));
container.add(uiTabbedPane, BorderLayout.CENTER); container.add(uiTabbedPane, BorderLayout.CENTER);
initPluginListener();
return container; return container;
} }
@ -192,6 +199,33 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
}); });
uiTabbedPane.addTab(title, settingPane); 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() { protected JPanel createCellStyleSettingPane() {
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane();
cellStyleSettingPane = new CellStyleListEditPane(); cellStyleSettingPane = new CellStyleListEditPane();
@ -223,6 +257,9 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
colorListPane.populate(theme.getColorScheme().getColors()); colorListPane.populate(theme.getColorScheme().getColors());
populateBean4CustomEditors(theme); populateBean4CustomEditors(theme);
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(theme);
}
isPopulating = false; isPopulating = false;
} }
@ -243,7 +280,9 @@ public abstract class TemplateThemeEditorPane<T extends TemplateTheme> extends J
theme.setColorScheme(colorScheme); theme.setColorScheme(colorScheme);
updateBean4CustomEditors(theme); updateBean4CustomEditors(theme);
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(theme);
}
return 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();
}

25
designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java

@ -14,6 +14,7 @@ import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateCellLinkP
import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane; import com.fr.design.chart.series.SeriesCondition.impl.ChartHyperRelateFloatLinkPane;
import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane; import com.fr.design.chart.series.SeriesCondition.impl.FormHyperlinkPane;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.fun.HyperlinkProvider; import com.fr.design.fun.HyperlinkProvider;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
@ -22,7 +23,10 @@ import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane; import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.javascript.JavaScriptImplPane; import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane; import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.mainframe.BaseJForm;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
import com.fr.js.FormHyperlinkProvider; import com.fr.js.FormHyperlinkProvider;
@ -297,5 +301,24 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
} }
} }
@Override
protected void initCreatorsFilter() {
this.creatorsFilter = nameableCreator -> {
Class<? extends JavaScript> clazz = nameableCreator.getHyperlink();
JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (!JTemplate.isValid(template)) {
return false;
}
Class[] classes = new Class[]{ChartHyperRelateCellLink.class, ChartHyperRelateFloatLink.class};
for (Class aClass : classes) {
if (template.getEditingReportIndex() == BaseJForm.FORM_TAB) {
// 编辑的是决策报表中的图表,那么没有ChartHyperRelateFloatLink 和 ChartHyperRelateCellLink 选项,有FormHyperlink 选项
if (ComparatorUtils.equals(aClass, clazz)) {
return false;
}
}
}
return true;
};
}
} }

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

@ -0,0 +1,50 @@
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 插入位置
*/
int getInsertPosition(int total);
/**
* 根据XCreator判断是否需要处理
*
* @param creator
* @return true:需要处理;false:不处理
*/
boolean accept(XCreator creator);
/**
* 根据Class判断是否需要处理
*
* @param creator
* @return true:需要处理;false:不处理
*/
boolean accept(Class 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();
}
}

13
designer-form/src/main/java/com/fr/design/gui/xpane/FormHyperlinkGroupPane.java

@ -1,13 +1,14 @@
package com.fr.design.gui.xpane; package com.fr.design.gui.xpane;
import com.fr.chart.web.ChartHyperRelateFloatLink;
import com.fr.design.form.javascript.FormEmailPane; import com.fr.design.form.javascript.FormEmailPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.js.EmailJavaScript; import com.fr.js.EmailJavaScript;
import com.fr.js.JavaScript;
public class FormHyperlinkGroupPane extends HyperlinkGroupPane { public class FormHyperlinkGroupPane extends HyperlinkGroupPane {
private static FormHyperlinkGroupPane singleton; private static FormHyperlinkGroupPane singleton;
@ -23,6 +24,16 @@ public class FormHyperlinkGroupPane extends HyperlinkGroupPane {
return singleton; return singleton;
} }
@Override
protected void initCreatorsFilter() {
this.creatorsFilter = nameableCreator -> {
Class<? extends JavaScript> clazz = nameableCreator.getHyperlink();
// 决策报表没有 ChartHyperRelateFloatLink
return !ComparatorUtils.equals(clazz, ChartHyperRelateFloatLink.class);
};
}
/** /**
* 生成添加按钮的NameableCreator * 生成添加按钮的NameableCreator
* 由于表单报表块的单元格超链和单元格条件属性超链中的emailPane都要用表单的emailPane这里调整下 * 由于表单报表块的单元格超链和单元格条件属性超链中的emailPane都要用表单的emailPane这里调整下

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.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.DataCreatorUI; import com.fr.design.data.DataCreatorUI;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.CRPropertyDescriptor; 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.fit.common.TemplateTool;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.fun.ParameterExpandablePaneUIProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; 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.design.widget.ui.designer.component.UIBoundSpinner;
import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WParameterLayout;
import com.fr.general.Background; 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 com.fr.report.stable.FormConstants;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -41,6 +46,8 @@ import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
@ -59,6 +66,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
//是否是新设计模式下决策报表 //是否是新设计模式下决策报表
private boolean newForm; private boolean newForm;
private PropertyGroupPane extraPropertyGroupPane; private PropertyGroupPane extraPropertyGroupPane;
protected final List<BasicBeanPane<WParameterLayout>> extraPaneList = new ArrayList<>();
private JPanel backgroundPane;
public RootDesignDefinePane(XCreator xCreator) { public RootDesignDefinePane(XCreator xCreator) {
super(xCreator); super(xCreator);
@ -144,7 +153,6 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
fireAfterEditor.setSelected(false); fireAfterEditor.setSelected(false);
} }
}); });
background = new AccessibleBackgroundEditor();
Icon[] hAlignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), 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_center_normal.png"),
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_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 = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left") 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")}); , 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 f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p}; 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}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{ 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_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[]{displayReport, null},
new Component[]{useParamsTemplate, null}, new Component[]{useParamsTemplate, null},
new Component[]{fireAfterEditor, null}, new Component[]{fireAfterEditor, null},
@ -176,6 +186,54 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
return jPanel; 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 * @param
* @Description: 获取新决策报表的AdvancePane * @Description: 获取新决策报表的AdvancePane
@ -199,8 +257,8 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
fireAfterEditor.setSelected(false); fireAfterEditor.setSelected(false);
} }
}); });
background = new AccessibleBackgroundEditor(); backgroundPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.initExtraPane();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p}; 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}}; int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{ 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_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[]{displayReport, null},
new Component[]{useParamsTemplate, null}, new Component[]{useParamsTemplate, null},
new Component[]{fireAfterEditor, null}, new Component[]{fireAfterEditor, null},
@ -229,7 +287,13 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
@Override @Override
public void populateBean(WParameterLayout ob) { public void populateBean(WParameterLayout ob) {
labelNameTextField.setText(ob.getLabelName()); 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()); displayReport.setSelected(ob.isDelayDisplayContent());
useParamsTemplate.setSelected(ob.isUseParamsTemplate()); useParamsTemplate.setSelected(ob.isUseParamsTemplate());
fireAfterEditor.setEnabled(ob.isUseParamsTemplate()); fireAfterEditor.setEnabled(ob.isUseParamsTemplate());
@ -277,8 +341,14 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
wParameterLayout.setParamsFireStopEdit(fireAfterEditor.isSelected()); wParameterLayout.setParamsFireStopEdit(fireAfterEditor.isSelected());
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected());
wParameterLayout.setBackground((Background) background.getValue());
wParameterLayout.setPosition((Integer) hAlignmentPane.getSelectedItem()); wParameterLayout.setPosition((Integer) hAlignmentPane.getSelectedItem());
if (extraPaneList.isEmpty()) {
wParameterLayout.setBackground((Background) background.getValue());
} else {
for (BasicBeanPane<WParameterLayout> pane : extraPaneList) {
pane.updateBean(wParameterLayout);
}
}
return wParameterLayout; return wParameterLayout;
} }
@ -299,6 +369,13 @@ public class RootDesignDefinePane extends AbstractDataModify<WParameterLayout> {
JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); JTemplate jTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected()); jTemplate.needAddTemplateIdAttr(useParamsTemplate.isSelected());
wParameterLayout.setBackground((Background) background.getValue()); 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(); int height = (int) paraHeight.getTextField().getValue();
FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign(); FormDesigner designer = TemplateTool.getCurrentEditingNewJForm().getFormDesign();

131
designer-form/src/main/java/com/fr/design/widget/ui/designer/ButtonDefinePane.java

@ -1,8 +1,11 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -11,18 +14,27 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.widget.accessibles.AccessibleIconEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleIconEditor;
import com.fr.design.widget.btn.ButtonConstants; import com.fr.design.widget.btn.ButtonConstants;
import com.fr.form.ui.Button; import com.fr.form.ui.Button;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import org.jetbrains.annotations.NotNull;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public abstract class ButtonDefinePane<T extends Button> extends AbstractDataModify<T> { public abstract class ButtonDefinePane<T extends Button> extends AbstractDataModify<T> {
private UITextField hotkeysTextField; private UITextField hotkeysTextField;
private UITextField buttonNameTextField; private UITextField buttonNameTextField;
private AccessibleIconEditor iconPane; private AccessibleIconEditor iconPane;
protected UITextField labelNameTextField; protected UITextField labelNameTextField;
private final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
private JPanel extraPane;
public ButtonDefinePane(XCreator creator){ public ButtonDefinePane(XCreator creator){
super(creator); super(creator);
@ -31,20 +43,70 @@ public abstract class ButtonDefinePane<T extends Button> extends AbstractDataMod
private void initComponent() { private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double rowSize[] = {p, p, p, p, p, p, p, p};
double columnSize[] = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
iconPane = new AccessibleIconEditor(); iconPane = new AccessibleIconEditor();
hotkeysTextField = new UITextField(); hotkeysTextField = new UITextField();
buttonNameTextField = new UITextField(); buttonNameTextField = new UITextField();
labelNameTextField = new UITextField(); labelNameTextField = new UITextField();
Component[] backgroundCompPane = createBackgroundComp();
Component[] frFont = createFontPane();
UILabel backgroundLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background")); UILabel backgroundLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Background"));
backgroundLabel.setVerticalAlignment(SwingConstants.TOP); backgroundLabel.setVerticalAlignment(SwingConstants.TOP);
Component[][] n_components = { initAdvancedPane();
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
boundsPane.add(extraPane);
UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, boundsPane);
this.add(advancedPane);
}
private void initAdvancedPane() {
initPluginListener();
refreshAdvancedPane();
}
private void refreshAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
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());
containsExtraPane = true;
}
refreshAdvancedPane(containsExtraPane);
}
private void refreshAdvancedPane(boolean containsExtraPane) {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
Component[] backgroundCompPane = createBackgroundComp();
Component[] frFont = createFontPane();
double[] rowSize;
double[] columnSize;
int[][] rowCount;
Component[][] n_components;
if (containsExtraPane) {
JPanel panel = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<T> pane : extraPaneList) {
panel.add(pane);
}
rowSize = new double[]{p, p, p, p, p};
columnSize = new double[]{p, f};
rowCount = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
n_components = getExtraAdvancedComponents(panel);
} else {
rowSize = new double[]{p, p, p, p, p, p, p, p};
columnSize = new double[]{p, f};
rowCount = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
n_components = getAdvancedComponents(backgroundCompPane, frFont);
}
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ","));
extraPane = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
extraPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@NotNull
private Component[][] getAdvancedComponents(Component[] backgroundCompPane, Component[] frFont) {
return new Component[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
backgroundCompPane, backgroundCompPane,
@ -52,13 +114,38 @@ public abstract class ButtonDefinePane<T extends Button> extends AbstractDataMod
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")), iconPane}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")), iconPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField} {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField}
}; };
hotkeysTextField.setToolTipText(StableUtils.join(ButtonConstants.HOTKEYS, ",")); }
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(n_components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); @NotNull
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); private Component[][] getExtraAdvancedComponents(JPanel panel) {
boundsPane.add(panel); return new Component[][]{
UIExpandablePane advancedPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, boundsPane); {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Name")), buttonNameTextField},
this.add(advancedPane); {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Label_Name")), labelNameTextField},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Icon")), iconPane},
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Hot_keys")), hotkeysTextField},
{panel, null}
};
}
protected void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
protected void insertShortCut(int index, BasicBeanPane<T> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
} }
@Override @Override
@ -80,6 +167,9 @@ public abstract class ButtonDefinePane<T extends Button> extends AbstractDataMod
buttonNameTextField.setText(btn.getText()); buttonNameTextField.setText(btn.getText());
labelNameTextField.setText(btn.getLabelName()); labelNameTextField.setText(btn.getLabelName());
iconPane.setValue(btn.getIconName()); iconPane.setValue(btn.getIconName());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(btn);
}
populateSubButtonPane(btn); populateSubButtonPane(btn);
} }
@ -94,6 +184,9 @@ public abstract class ButtonDefinePane<T extends Button> extends AbstractDataMod
btn.setLabelName(labelNameTextField.getText()); btn.setLabelName(labelNameTextField.getText());
btn.setIconName((String)iconPane.getValue()); btn.setIconName((String)iconPane.getValue());
btn.setText(buttonNameTextField.getText()); btn.setText(buttonNameTextField.getText());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(btn);
}
return btn; return btn;
} }

83
designer-form/src/main/java/com/fr/design/widget/ui/designer/CheckBoxDefinePane.java

@ -1,8 +1,11 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -11,18 +14,28 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.design.widget.ui.designer.component.FontSizeComboPane;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.CheckBox; import com.fr.form.ui.CheckBox;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.Component; import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> { public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
private UITextField text; private UITextField text;
private FontSizeComboPane fontSizePane; private FontSizeComboPane fontSizePane;
private FormWidgetValuePane formWidgetValuePane; private FormWidgetValuePane formWidgetValuePane;
protected UITextField labelNameTextField; protected UITextField labelNameTextField;
protected final List<BasicBeanPane<CheckBox>> extraPaneList = new ArrayList<>();
protected JPanel extraPane;
protected static double F = TableLayout.FILL;
protected static double P = TableLayout.PREFERRED;
public CheckBoxDefinePane(XCreator xCreator) { public CheckBoxDefinePane(XCreator xCreator) {
super(xCreator); super(xCreator);
@ -37,16 +50,15 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
UILabel widgetValueLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value")); UILabel widgetValueLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value"));
widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); widgetValueLabel.setVerticalAlignment(SwingConstants.TOP);
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
double f = TableLayout.FILL; initExtraPane();
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ 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_Form_Label_Name")), labelNameTextField},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text")), text }, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Text")), text },
new Component[]{widgetValueLabel, formWidgetValuePane }, new Component[]{widgetValueLabel, formWidgetValuePane },
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}, new Component[]{extraPane, null},
}; };
double[] rowSize = {p, p, p, p, p, p}; double[] rowSize = {P, P, P, P, P, P};
double[] columnSize = {p, f}; double[] columnSize = {P, F};
int[][] rowCount = {{1, 1},{1, 1}, {1, 3},{1, 1}}; int[][] rowCount = {{1, 1},{1, 1}, {1, 3},{1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -57,6 +69,59 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
this.add(uiExpandablePane); this.add(uiExpandablePane);
} }
protected void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<CheckBox>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<CheckBox> provider : providers) {
if (!provider.accept(creator)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<CheckBox> pane : extraPaneList) {
extraPane.add(pane);
}
} else {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
}
}
protected void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
protected void insertShortCut(int index, BasicBeanPane<CheckBox> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
@Override @Override
public String title4PopupWindow() { public String title4PopupWindow() {
return "CheckBox"; return "CheckBox";
@ -68,6 +133,9 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
fontSizePane.setValue(check.getFontSize()); fontSizePane.setValue(check.getFontSize());
formWidgetValuePane.populate(check); formWidgetValuePane.populate(check);
labelNameTextField.setText(check.getLabelName()); labelNameTextField.setText(check.getLabelName());
for (BasicBeanPane<CheckBox> pane : extraPaneList) {
pane.populateBean(check);
}
} }
@Override @Override
@ -77,6 +145,9 @@ public class CheckBoxDefinePane extends AbstractDataModify<CheckBox> {
box.setFontSize(fontSizePane.getValue()); box.setFontSize(fontSizePane.getValue());
formWidgetValuePane.update(box); formWidgetValuePane.update(box);
box.setLabelName(labelNameTextField.getText()); box.setLabelName(labelNameTextField.getText());
for (BasicBeanPane<CheckBox> pane : extraPaneList) {
pane.updateBean(box);
}
return box; return box;
} }
} }

50
designer-form/src/main/java/com/fr/design/widget/ui/designer/DateEditorDefinePane.java

@ -2,15 +2,17 @@ package com.fr.design.widget.ui.designer;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.data.core.FormatField; import com.fr.data.core.FormatField;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.component.DateValuePane; import com.fr.design.widget.component.DateValuePane;
import com.fr.design.widget.component.UIComboBoxNoArrow; import com.fr.design.widget.component.UIComboBoxNoArrow;
@ -18,18 +20,23 @@ import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.design.widget.ui.designer.date.DateFormatCheckManager; import com.fr.design.widget.ui.designer.date.DateFormatCheckManager;
import com.fr.design.widget.ui.designer.date.DateFormatCheckResult; import com.fr.design.widget.ui.designer.date.DateFormatCheckResult;
import com.fr.form.ui.DateEditor; import com.fr.form.ui.DateEditor;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder; import javax.swing.border.TitledBorder;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener; import javax.swing.event.ChangeListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Set;
public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> { public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor> {
private UIButtonGroup returnTypeComboBox; private UIButtonGroup returnTypeComboBox;
@ -68,8 +75,7 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
JPanel formatHead = createFormatHead(); JPanel formatHead = createFormatHead();
startDv = new DateValuePane(); startDv = new DateValuePane();
endDv = new DateValuePane(); endDv = new DateValuePane();
double f = TableLayout.FILL; initExtraPane();
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ 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_Form_Label_Name")), labelNameTextField},
new Component[]{widgetValueLabel, formWidgetValuePane}, new Component[]{widgetValueLabel, formWidgetValuePane},
@ -77,12 +83,12 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
new Component[]{startDateLabel, startDv}, new Component[]{startDateLabel, startDv},
new Component[]{endDateLabel, endDv}, new Component[]{endDateLabel, endDv},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), waterMarkDictPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), waterMarkDictPane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}, new Component[]{extraPane, null},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox} new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Date_Selector_Return_Type")), returnTypeComboBox}
}; };
double[] rowSize = {p, p, p, p, p, p, p, p, p, p}; double[] rowSize = {P, P, P, P, P, P, P, P, P, P};
double[] columnSize = {p, f}; double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -90,6 +96,32 @@ public class DateEditorDefinePane extends DirectWriteEditorDefinePane<DateEditor
return boundsPane; return boundsPane;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<DateEditor>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<DateEditor> provider : providers) {
if (!provider.accept(creator)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<DateEditor> pane : extraPaneList) {
extraPane.add(pane);
}
} else {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane},
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
}
}
private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){ private JPanel createFormatPane(UIComboBox formatComboBox, UILabel sampleLabel){
JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel previewPane = FRGUIPaneFactory.createBorderLayout_S_Pane();

51
designer-form/src/main/java/com/fr/design/widget/ui/designer/DirectWriteEditorDefinePane.java

@ -1,19 +1,26 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.DirectWriteEditor; import com.fr.form.ui.DirectWriteEditor;
import javax.swing.BorderFactory;
import javax.swing.*; import javax.swing.JComponent;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.util.Set;
//richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树 //richer:需要提供能否直接编辑的控件设置面板——下拉框、复选框、时间、日期、下拉树
public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> { public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> extends FieldEditorDefinePane<T> {
@ -34,18 +41,17 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
Component[] removeRepeatPane = new Component[]{createRepeatCheckBox(), null}; Component[] removeRepeatPane = new Component[]{createRepeatCheckBox(), null};
Component[] dicPane = createDictPane(); Component[] dicPane = createDictPane();
Component[] waterMarkComponent = createWaterMarkPane(); Component[] waterMarkComponent = createWaterMarkPane();
double f = TableLayout.FILL; initExtraPane();
double p = TableLayout.PREFERRED;
Component[][] components = new Component[][]{ 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_Form_Label_Name")), labelNameTextField},
new Component[]{widgetValueLabel, formWidgetValuePane }, new Component[]{widgetValueLabel, formWidgetValuePane },
dicPane, dicPane,
removeRepeatPane, removeRepeatPane,
waterMarkComponent, waterMarkComponent,
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} new Component[]{extraPane, null}
}; };
double[] rowSize = {p, p, p, p, p, p, p, p}; double[] rowSize = {P, P, P, P, P, P, P, P};
double[] columnSize = {p, f}; double[] columnSize = {P, F};
int[][] rowCount = {{1, 1},{1, 3},{1, 1},{1, 1},{1,1},{1,1}}; int[][] rowCount = {{1, 1},{1, 3},{1, 1},{1, 1},{1,1},{1,1}};
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
// panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); // panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
@ -58,6 +64,33 @@ public abstract class DirectWriteEditorDefinePane<T extends DirectWriteEditor> e
return advancePane; return advancePane;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
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());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<T> pane : extraPaneList) {
extraPane.add(pane);
}
} else {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
}
}
public UICheckBox createRepeatCheckBox(){ public UICheckBox createRepeatCheckBox(){
return null; return null;
} }

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

@ -1,6 +1,7 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.ErrorMsgTextFieldAdapter; import com.fr.design.beans.ErrorMsgTextFieldAdapter;
import com.fr.design.beans.UITextFieldAdapter; import com.fr.design.beans.UITextFieldAdapter;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
@ -12,14 +13,19 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.TextFieldAdapterProvider; import com.fr.design.fun.TextFieldAdapterProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FontSizeComboPane; import com.fr.design.widget.ui.designer.component.FontSizeComboPane;
import com.fr.form.ui.FieldEditor; import com.fr.form.ui.FieldEditor;
import com.fr.general.GeneralContext;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
@ -27,6 +33,8 @@ import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> { public abstract class FieldEditorDefinePane<T extends FieldEditor> extends AbstractDataModify<T> {
protected UICheckBox allowBlankCheckBox; protected UICheckBox allowBlankCheckBox;
@ -35,7 +43,11 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
protected JPanel validatePane; protected JPanel validatePane;
protected FontSizeComboPane fontSizePane; protected FontSizeComboPane fontSizePane;
protected UITextField labelNameTextField; protected UITextField labelNameTextField;
protected final List<BasicBeanPane<T>> extraPaneList = new ArrayList<>();
protected JPanel extraPane;
protected static double F = TableLayout.FILL;
protected static double P = TableLayout.PREFERRED;
public FieldEditorDefinePane(XCreator xCreator) { public FieldEditorDefinePane(XCreator xCreator) {
super(xCreator); super(xCreator);
@ -59,12 +71,24 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
this.addValidatePane(); this.addValidatePane();
} }
protected void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
protected void refreshExtraAdvancedPane() {
// do nothing
}
@Override @Override
public void populateBean(T ob) { public void populateBean(T ob) {
this.allowBlankCheckBox.setSelected(ob.isAllowBlank()); this.allowBlankCheckBox.setSelected(ob.isAllowBlank());
this.errorMsgTextField.setText(ob.getErrorMessage()); this.errorMsgTextField.setText(ob.getErrorMessage());
this.fontSizePane.setValue(ob.getFontSize()); this.fontSizePane.setValue(ob.getFontSize());
this.labelNameTextField.setText(ob.getLabelName()); this.labelNameTextField.setText(ob.getLabelName());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.populateBean(ob);
}
populateSubFieldEditorBean(ob); populateSubFieldEditorBean(ob);
} }
@ -78,6 +102,9 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
e.setErrorMessage(this.errorMsgTextField.getText()); e.setErrorMessage(this.errorMsgTextField.getText());
e.setFontSize(fontSizePane.getValue()); e.setFontSize(fontSizePane.getValue());
e.setLabelName(labelNameTextField.getText()); e.setLabelName(labelNameTextField.getText());
for (BasicBeanPane<T> pane : extraPaneList) {
pane.updateBean(e);
}
return e; return e;
} }
@ -152,4 +179,25 @@ public abstract class FieldEditorDefinePane<T extends FieldEditor> extends Abstr
return null; return null;
} }
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
protected void insertShortCut(int index, BasicBeanPane<T> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
protected void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
} }

103
designer-form/src/main/java/com/fr/design/widget/ui/designer/LabelDefinePane.java

@ -1,10 +1,13 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ibutton.UIButtonGroup; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icheckbox.UICheckBox; import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -15,11 +18,20 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.Label; import com.fr.form.ui.Label;
import com.fr.general.GeneralContext;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.*; import javax.swing.BorderFactory;
import java.awt.*; import javax.swing.Icon;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
/** /**
@ -33,6 +45,11 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
private UIButtonGroup hAlignmentPane; private UIButtonGroup hAlignmentPane;
private FRFontPane frFontPane; private FRFontPane frFontPane;
private final List<BasicBeanPane<Label>> extraPaneList = new ArrayList<>();
private JPanel extraPane;
private static final double F = TableLayout.FILL;
private static final double P = TableLayout.PREFERRED;
public LabelDefinePane(XCreator xCreator) { public LabelDefinePane(XCreator xCreator) {
super(xCreator); super(xCreator);
initComponent(); initComponent();
@ -59,12 +76,9 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment); hAlignmentPane = new UIButtonGroup<Integer>(hAlignmentIconArray, hAlignment);
hAlignmentPane.setAllToolTips(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left") 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")}); , com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right")});
// 字体大小是浮点数,因为涉及很多字体计算,不太好修改,为了完整显示字体,将FRFontPane中的fontSizeComboBox拉长一点 initExtraPane();
frFontPane = new FRFontPane(LayoutConstants.VGAP_MEDIUM); double[] rowSize = {P, P, P, P, P, P};
double f = TableLayout.FILL; double[] columnSize = {F, WIDGET_VALUE_PANE_WIDTH};
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p, p};
double[] columnSize = {f, WIDGET_VALUE_PANE_WIDTH};
int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 3}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
UILabel widgetValueLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value")); UILabel widgetValueLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value"));
widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); widgetValueLabel.setVerticalAlignment(SwingConstants.TOP);
@ -75,7 +89,7 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
new Component[]{isStyleAlignmentWrapText, null}, new Component[]{isStyleAlignmentWrapText, null},
new Component[]{isPageSetupVertically, null}, new Component[]{isPageSetupVertically, null},
new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position_Similar")), hAlignmentPane}, new Component[]{FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Display_Position_Similar")), hAlignmentPane},
new Component[]{fontLabel, frFontPane}, new Component[]{extraPane, null},
}; };
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W4 - 5, IntervalConstants.INTERVAL_L1); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W4 - 5, IntervalConstants.INTERVAL_L1);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -84,6 +98,61 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
return boundsPane; return boundsPane;
} }
private void initExtraPane() {
initPluginListener();
refreshExtraAdvancedPane();
}
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<Label>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<Label> provider : providers) {
if (!provider.accept(creator)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<Label> pane : extraPaneList) {
extraPane.add(pane);
}
} else {
// 字体大小是浮点数,因为涉及很多字体计算,不太好修改,为了完整显示字体,将FRFontPane中的fontSizeComboBox拉长一点
frFontPane = new FRFontPane(LayoutConstants.VGAP_MEDIUM);
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), frFontPane}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
}
}
protected void initPluginListener() {
GeneralContext.listenPluginRunningChanged(new PluginEventListener() {
@Override
public void on(PluginEvent event) {
refreshExtraAdvancedPane();
}
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG));
}
/**
* 插入配置项面板
*
* @param index 插入的位置
* @param pane 配置项面板
*/
protected void insertShortCut(int index, BasicBeanPane<Label> pane) {
int size = extraPaneList.size();
index = Math.min(index, size);
extraPaneList.add(index, pane);
}
@Override @Override
public String title4PopupWindow() { public String title4PopupWindow() {
return "label"; return "label";
@ -95,7 +164,12 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
isStyleAlignmentWrapText.setSelected(ob.isWrap()); isStyleAlignmentWrapText.setSelected(ob.isWrap());
isPageSetupVertically.setSelected(ob.isVerticalCenter()); isPageSetupVertically.setSelected(ob.isVerticalCenter());
hAlignmentPane.setSelectedItem(ob.getTextalign()); hAlignmentPane.setSelectedItem(ob.getTextalign());
frFontPane.populateBean(ob.getFont()); if(frFontPane != null) {
frFontPane.populateBean(ob.getFont());
}
for (BasicBeanPane<Label> pane : extraPaneList) {
pane.populateBean(ob);
}
} }
@ -106,7 +180,12 @@ public class LabelDefinePane extends AbstractDataModify<Label> {
layout.setWrap(isStyleAlignmentWrapText.isSelected()); layout.setWrap(isStyleAlignmentWrapText.isSelected());
layout.setVerticalCenter(isPageSetupVertically.isSelected()); layout.setVerticalCenter(isPageSetupVertically.isSelected());
layout.setTextalign((int) hAlignmentPane.getSelectedItem()); layout.setTextalign((int) hAlignmentPane.getSelectedItem());
layout.setFont(frFontPane.update(layout.getFont())); if(frFontPane != null && layout.getFont() != null) {
layout.setFont(frFontPane.update(layout.getFont()));
}
for (BasicBeanPane<Label> pane : extraPaneList) {
pane.updateBean(layout);
}
return layout; return layout;
} }
} }

42
designer-form/src/main/java/com/fr/design/widget/ui/designer/NumberEditorDefinePane.java

@ -1,7 +1,10 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner; import com.fr.design.gui.ispinner.UIBasicSpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -11,9 +14,12 @@ import com.fr.design.widget.component.NumberEditorValidatePane;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.NumberEditor; import com.fr.form.ui.NumberEditor;
import javax.swing.JComponent;
import javax.swing.*; import javax.swing.JFormattedTextField;
import java.awt.*; import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component;
import java.util.Set;
public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> { public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor> {
public NumberEditorDefinePane(XCreator xCreator){ public NumberEditorDefinePane(XCreator xCreator){
@ -43,11 +49,12 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
initExtraPane();
Component[][] components = new Component[][]{ 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_Form_Label_Name")), labelNameTextField},
new Component[]{widgetValueLabel, formWidgetValuePane}, new Component[]{widgetValueLabel, formWidgetValuePane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), waterMarkDictPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark")), waterMarkDictPane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane} new Component[]{extraPane, null}
}; };
double[] rowSize = {p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {p,f}; double[] columnSize = {p,f};
@ -58,6 +65,33 @@ public class NumberEditorDefinePane extends FieldEditorDefinePane<NumberEditor>
return boundsPane; return boundsPane;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<NumberEditor>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<NumberEditor> provider : providers) {
if (!provider.accept(creator)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<NumberEditor> pane : extraPaneList) {
extraPane.add(pane);
}
} else {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
}
}
public JPanel setValidatePane() { public JPanel setValidatePane() {
numberEditorValidatePane = new NumberEditorValidatePane(); numberEditorValidatePane = new NumberEditorValidatePane();
return numberEditorValidatePane; return numberEditorValidatePane;

40
designer-form/src/main/java/com/fr/design/widget/ui/designer/TextFieldEditorDefinePane.java

@ -1,15 +1,16 @@
package com.fr.design.widget.ui.designer; package com.fr.design.widget.ui.designer;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.fun.RegPaneProvider; import com.fr.design.fun.RegPaneProvider;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.frpane.RegFieldPane; import com.fr.design.gui.frpane.RegFieldPane;
import com.fr.design.gui.frpane.RegPane; import com.fr.design.gui.frpane.RegPane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.TextEditor; import com.fr.form.ui.TextEditor;
@ -21,6 +22,7 @@ import javax.swing.SwingConstants;
import java.awt.Component; import java.awt.Component;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.util.Set;
public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> { public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor> {
protected RegFieldPane regPane; protected RegFieldPane regPane;
@ -63,18 +65,17 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
}); });
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
UILabel widgetValueLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value"), SwingConstants.LEFT); UILabel widgetValueLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Estate_Widget_Value"), SwingConstants.LEFT);
widgetValueLabel.setVerticalAlignment(SwingConstants.TOP); widgetValueLabel.setVerticalAlignment(SwingConstants.TOP);
initExtraPane();
Component[][] components = new Component[][]{ 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_Form_Label_Name")), labelNameTextField},
new Component[]{widgetValueLabel, formWidgetValuePane}, new Component[]{widgetValueLabel, formWidgetValuePane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"), SwingConstants.LEFT), waterMarkDictPane}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_WaterMark"), SwingConstants.LEFT), waterMarkDictPane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT), fontSizePane} new Component[]{extraPane, null}
}; };
double[] rowSize = {p, p, p, p, p, p}; double[] rowSize = {P, P, P, P, P};
double[] columnSize = {p, f}; double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}, {1, 3}, {1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 3}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel boundsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -82,6 +83,33 @@ public class TextFieldEditorDefinePane extends FieldEditorDefinePane<TextEditor>
return boundsPane; return boundsPane;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
Set<WidgetAdvancedPaneProvider<TextEditor>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG);
for (WidgetAdvancedPaneProvider<TextEditor> provider : providers) {
if (!provider.accept(creator)) {
continue;
}
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<TextEditor> pane : extraPaneList) {
extraPane.add(pane);
}
} else {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size"), SwingConstants.LEFT), fontSizePane}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
}
}
public JPanel setValidatePane() { public JPanel setValidatePane() {
return regPane; return regPane;
} }

43
designer-form/src/main/java/com/fr/design/widget/ui/designer/btn/ButtonGroupDefinePane.java

@ -1,8 +1,11 @@
package com.fr.design.widget.ui.designer.btn; package com.fr.design.widget.ui.designer.btn;
import com.fr.data.Dictionary; import com.fr.data.Dictionary;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.XCreator;
import com.fr.design.fun.WidgetAdvancedPaneProvider;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -13,9 +16,11 @@ import com.fr.design.widget.ui.designer.FieldEditorDefinePane;
import com.fr.design.widget.ui.designer.component.FormWidgetValuePane; import com.fr.design.widget.ui.designer.component.FormWidgetValuePane;
import com.fr.form.ui.ButtonGroup; import com.fr.form.ui.ButtonGroup;
import javax.swing.JPanel;
import javax.swing.*; import javax.swing.SwingConstants;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.util.Set;
/** /**
* Created by ibm on 2017/8/5. * Created by ibm on 2017/8/5.
@ -40,11 +45,12 @@ public abstract class ButtonGroupDefinePane<T extends ButtonGroup> extends Field
formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false); formWidgetValuePane = new FormWidgetValuePane(creator.toData(), false);
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
initExtraPane();
Component[][] components = new Component[][]{ 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_Form_Label_Name")), labelNameTextField},
new Component[]{widgetValueLabel, formWidgetValuePane}, new Component[]{widgetValueLabel, formWidgetValuePane},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary")), dictionaryEditor}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary")), dictionaryEditor},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}, new Component[]{extraPane, null},
new Component[]{buttonGroupDictPane, null} new Component[]{buttonGroupDictPane, null}
}; };
double[] rowSize = {p, p, p, p, p, p, p}; double[] rowSize = {p, p, p, p, p, p, p};
@ -60,6 +66,33 @@ public abstract class ButtonGroupDefinePane<T extends ButtonGroup> extends Field
return advancePane; return advancePane;
} }
protected void refreshExtraAdvancedPane() {
extraPaneList.clear();
boolean containsExtraPane = false;
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());
containsExtraPane = true;
}
if (containsExtraPane) {
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
for (BasicBeanPane<T> pane : extraPaneList) {
extraPane.add(pane);
}
} else {
Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Font_Size")), fontSizePane}
};
double[] rowSize = {P};
double[] columnSize = {P, F};
int[][] rowCount = {{1, 1}};
extraPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
}
}
public JPanel createOtherPane() { public JPanel createOtherPane() {
return null; return null;
} }

2
designer-realize/src/main/java/com/fr/design/actions/file/export/ExcelExportAction.java

@ -12,7 +12,7 @@ public class ExcelExportAction extends AbstractExcelExportAction {
public ExcelExportAction(JWorkBook jwb) { public ExcelExportAction(JWorkBook jwb) {
super(jwb); super(jwb);
this.setMenuKeySet(KeySetUtils.SIMPLE_EXCEL_EXPORT); this.setMenuKeySet(KeySetUtils.SIMPLE_EXCEL_EXPORT);
this.setName(getMenuKeySet().getMenuKeySetName()); this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic()); this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png"));
} }

2
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceMainDialog.java

@ -68,7 +68,7 @@ public class ITReplaceMainDialog extends UIDialog {
private static final int FIRST_ROW = 0; private static final int FIRST_ROW = 0;
private static final int NONE = 0; private static final int NONE = 0;
public static int selectCount = 0; public static int selectCount = 0;
public static int MAIN_PANEL_WIDTH = 929; public static final int MAIN_PANEL_WIDTH = 800;
public static int replaceContentNum = 0; public static int replaceContentNum = 0;
public static int replaceSettingNum = 0; public static int replaceSettingNum = 0;
public static int contentReplaceCount = 0; public static int contentReplaceCount = 0;

19
designer-realize/src/main/java/com/fr/design/actions/replace/ui/ITReplaceNorthPanel.java

@ -18,7 +18,6 @@ import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.ComboBoxEditor; import javax.swing.ComboBoxEditor;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.ScrollPaneConstants; import javax.swing.ScrollPaneConstants;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
@ -80,12 +79,12 @@ public class ITReplaceNorthPanel {
//存储的5次最近输入 //存储的5次最近输入
private int maxItemCount = 5; private int maxItemCount = 5;
private static int limit_width = 800; private static final int LIMIT_WIDTH = 800;
private static final int HEIGHT = 161; private static final int HEIGHT = 161;
private static final int BUTTON_WIDTH = 44; private static final int BUTTON_WIDTH = 44;
private static final int GAP = 20; private static final int GAP = 20;
private static final int BUTTON_GAP = 10; private static final int BUTTON_GAP = 10;
private static final int MATCH_WIDTH = 70; private static final int MATCH_WIDTH = 800;
private static final int COMPONENT_HEIGHT = 25; private static final int COMPONENT_HEIGHT = 25;
private static final int FIRST_Y = 15, SECOND_Y = 50, THIRD_Y = 85, FOURTH_Y = 120; private static final int FIRST_Y = 15, SECOND_Y = 50, THIRD_Y = 85, FOURTH_Y = 120;
private static final int FIRST_X = 20, SECOND_X = 80; private static final int FIRST_X = 20, SECOND_X = 80;
@ -169,16 +168,6 @@ public class ITReplaceNorthPanel {
cardPanel.add(settingScrollPane, CARD_SETTING); cardPanel.add(settingScrollPane, CARD_SETTING);
} }
/**
* 限制尺寸
*
* @param width
*/
public void setLimitSize(int width) {
upContentPanel.setMaximumSize(new Dimension(limit_width, HEIGHT));
upContentPanel.setPreferredSize(new Dimension(limit_width, HEIGHT));
}
/** /**
* 初始化模板内容查找面板 * 初始化模板内容查找面板
*/ */
@ -212,7 +201,7 @@ public class ITReplaceNorthPanel {
replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button")); replaceButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button"));
searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button")); searchButton = new UIButton(Toolkit.i18nText("Fine-Design_Search_Button"));
upContentPanel.setPreferredSize(new Dimension(limit_width, HEIGHT)); upContentPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT));
contentScrollPane = new UIScrollPane(upContentPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); contentScrollPane = new UIScrollPane(upContentPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
upContentPanel.add(findLabel); upContentPanel.add(findLabel);
upContentPanel.add(rangeLabel); upContentPanel.add(rangeLabel);
@ -268,7 +257,7 @@ public class ITReplaceNorthPanel {
replaceSettingButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button")); replaceSettingButton = new UIButton(Toolkit.i18nText("Fine-Design_Replace_Button"));
replaceSettingButton.setEnabled(false); replaceSettingButton.setEnabled(false);
upSettingPanel.setPreferredSize(new Dimension(limit_width, HEIGHT)); upSettingPanel.setPreferredSize(new Dimension(LIMIT_WIDTH, HEIGHT));
upSettingPanel.add(findSettingLabel); upSettingPanel.add(findSettingLabel);
upSettingPanel.add(rangeSettingLabel); upSettingPanel.add(rangeSettingLabel);
upSettingPanel.add(findSettingComboBox); upSettingPanel.add(findSettingComboBox);

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

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

28
designer-realize/src/main/java/com/fr/design/mainframe/ReportHyperlinkGroupPane.java

@ -1,21 +1,11 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.Style;
import com.fr.design.actions.utils.ReportActionUtils;
import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.gui.frpane.HyperlinkGroupPane; import com.fr.design.gui.frpane.HyperlinkGroupPane;
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider;
import com.fr.general.FRFont; import com.fr.general.ComparatorUtils;
import com.fr.grid.selection.CellSelection; import com.fr.js.FormHyperlinkProvider;
import com.fr.grid.selection.FloatSelection; import com.fr.stable.bridge.StableFactory;
import com.fr.grid.selection.Selection;
import com.fr.js.NameJavaScriptGroup;
import com.fr.report.cell.CellElement;
import com.fr.report.cell.FloatElement;
import com.fr.report.elementcase.TemplateElementCase;
import com.fr.stable.Constants;
import java.awt.*;
/** /**
* Created by plough on 2017/7/21. * Created by plough on 2017/7/21.
@ -37,10 +27,20 @@ public class ReportHyperlinkGroupPane extends HyperlinkGroupPane {
} }
protected void refreshPane() { protected void refreshPane() {
ElementCasePane reportPane = ((JWorkBook)HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane(); ElementCasePane reportPane = ((JWorkBook) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate()).getEditingElementCasePane();
if (reportPane == null) { if (reportPane == null) {
return; return;
} }
populate(reportPane); populate(reportPane);
} }
@Override
protected void initCreatorsFilter() {
this.creatorsFilter = nameableCreator -> {
// 如果是普通报表单元格,那么没有 FormHyperlink 选项
FormHyperlinkProvider formHyperlink = StableFactory.getMarkedInstanceObjectFromClass(FormHyperlinkProvider.XML_TAG, FormHyperlinkProvider.class);
return !ComparatorUtils.equals(nameableCreator.getHyperlink(), formHyperlink.getClass());
};
}
} }

49
designer-realize/src/main/java/com/fr/design/mainframe/alphafine/search/manager/impl/PluginSearchManager.java

@ -20,6 +20,7 @@ import com.fr.plugin.basic.version.Version;
import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.plugin.basic.version.VersionIntervalFactory;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.ProductConstants;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -29,7 +30,7 @@ import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.ToLongFunction; import java.util.stream.Collectors;
/** /**
* Created by XiaXiang on 2017/3/27. * Created by XiaXiang on 2017/3/27.
@ -120,7 +121,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
return lessModelList; return lessModelList;
} }
SearchResult noConnectList = AlphaFineHelper.getNoConnectList(Holder.INSTANCE); SearchResult noConnectList = AlphaFineHelper.getNoConnectList(Holder.INSTANCE);
if(noConnectList != null){ if (noConnectList != null) {
return noConnectList; return noConnectList;
} }
for (int j = 0; j < searchText.length; j++) { for (int j = 0; j < searchText.length; j++) {
@ -184,7 +185,7 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
List<PluginModel> pluginModels = new ArrayList<>(); List<PluginModel> pluginModels = new ArrayList<>();
pluginModels.addAll(parseDefaultPluginModel(plugins)); pluginModels.addAll(parseDefaultPluginModel(plugins));
pluginModels.forEach(m->this.defaultModelList.add(m)); pluginModels.forEach(m -> this.defaultModelList.add(m));
} catch (Exception e) { } catch (Exception e) {
FineLoggerFactory.getLogger().error("plugin search error :" + e.getMessage()); FineLoggerFactory.getLogger().error("plugin search error :" + e.getMessage());
@ -196,33 +197,31 @@ public class PluginSearchManager implements AlphaFineSearchProvider {
/** /**
* 将jsonobject转化为PluginModel * 将jsonobject转化为PluginModel
* 并按照更新时间排序取最新的10个 * 并按照更新时间排序取最新的10个并过滤掉不是当前版本的
* */ */
List<PluginModel> parseDefaultPluginModel(List<Map> jsonObjects) { List<PluginModel> parseDefaultPluginModel(List<Map> jsonObjects) {
List<PluginModel> pluginModels = new ArrayList<>(); List<PluginModel> pluginModels = new ArrayList<>();
String version = "v" + ProductConstants.MAIN_VERSION;
if (!Collections.isEmpty(jsonObjects)) { if (!Collections.isEmpty(jsonObjects)) {
SimpleDateFormat format = new SimpleDateFormat(TIME_FORMAT); pluginModels = jsonObjects.stream()
try { .filter(o -> ((Integer) o.get(version)) == 1)
jsonObjects.sort(Comparator.comparingLong(new ToLongFunction<Map>() { .sorted((Map map1, Map map2) -> Long.compare(parseTime(map2), parseTime(map1)))
@Override .limit(DEFAULT_LIST_SIZE)
public long applyAsLong(Map value) { .map(jsonObject -> getPluginModel(new JSONObject(jsonObject), false))
long time = 0L; .collect(Collectors.toList());
try {
time = format.parse((String) value.get(UPLOAD_TIME)).getTime();
} catch (ParseException e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return time;
}
}).reversed());
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
for (int i = 0; i < DEFAULT_LIST_SIZE; i++) {
pluginModels.add(getPluginModel(new JSONObject(jsonObjects.get(i)), false));
}
} }
return pluginModels; return pluginModels;
} }
private static long parseTime(Map value) {
SimpleDateFormat format = new SimpleDateFormat(TIME_FORMAT);
long t = 0L;
try {
t = format.parse((String) value.get(UPLOAD_TIME)).getTime();
} catch (ParseException e) {
FineLoggerFactory.getLogger().error(e, e.getMessage());
}
return t;
}
} }

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

@ -1,6 +1,5 @@
package com.fr.design.mainframe.socketio; package com.fr.design.mainframe.socketio;
import com.fr.decision.webservice.utils.DecisionServiceConstants;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.RemoteDesignConstants; import com.fr.report.RemoteDesignConstants;
@ -14,6 +13,8 @@ import com.fr.workspace.Workspace;
import com.fr.workspace.base.WorkspaceConstants; import com.fr.workspace.base.WorkspaceConstants;
import com.fr.workspace.connect.WorkspaceConnection; import com.fr.workspace.connect.WorkspaceConnection;
import com.fr.workspace.connect.WorkspaceConnectionInfo; 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.client.IO;
import io.socket.engineio.client.transports.Polling; import io.socket.engineio.client.transports.Polling;
import io.socket.engineio.client.transports.WebSocket; import io.socket.engineio.client.transports.WebSocket;
@ -83,14 +84,17 @@ public abstract class AbstractSocketConfig {
WorkspaceConnection connection = current.getConnection(); WorkspaceConnection connection = current.getConnection();
currentProtocol = getCurrentProtocolFromUrl(url); currentProtocol = getCurrentProtocolFromUrl(url);
String[] result = new String[ports.length]; 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++) { for (int i = 0; i < ports.length; i++) {
result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s", result[i] = String.format("%s://%s:%s%s?%s=%s&%s=%s",
currentProtocol, currentProtocol,
url.getHost(), url.getHost(),
ports[i], ports[i],
WorkspaceConstants.WS_NAMESPACE, WorkspaceConstants.WS_NAMESPACE,
DecisionServiceConstants.WEB_SOCKET_TOKEN_NAME, verifier.getVerifierPrefix(),
connection.getToken(), verifier.getVerifierCode(),
RemoteDesignConstants.USER_LOCK_ID, RemoteDesignConstants.USER_LOCK_ID,
connection.getId()); connection.getId());
} }

Loading…
Cancel
Save