Browse Source

Merge remote-tracking branch 'origin/release/11.0' into release/11.0

release/11.0
obo 11 months ago
parent
commit
e6b9877235
  1. 14
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java
  2. 6
      designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java
  3. 4
      designer-base/src/main/java/com/fr/design/extra/PluginUtils.java
  4. 41
      designer-base/src/test/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPaneTest.java

14
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java

@ -61,6 +61,7 @@ import com.fr.stable.ArrayUtils;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import org.jetbrains.annotations.NotNull;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Box; import javax.swing.Box;
@ -416,10 +417,7 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
} }
private void checkParameter() { private void checkParameter() {
String[] paramTexts = new String[2]; Parameter[] parameters = getParameters();
paramTexts[0] = this.sqlTextPane.getText();
paramTexts[1] = this.pageQuery;
Parameter[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false);
if (parameters.length < 1 && this.editorPane.update().size() < 1) { if (parameters.length < 1 && this.editorPane.update().size() < 1) {
return; return;
@ -443,6 +441,14 @@ public class DBTableDataPane extends AbstractTableDataPane<DBTableData> implemen
refreshParameters(); refreshParameters();
} }
@NotNull
private Parameter[] getParameters() {
String[] paramTexts = new String[2];
paramTexts[0] = SqlUtils.clearSqlComments(this.sqlTextPane.getText());
paramTexts[1] = SqlUtils.clearSqlComments(this.pageQuery);
return ParameterHelper.analyze4Parameters(paramTexts, false);
}
@Override @Override
public void populateBean(DBTableData dbTableData) { public void populateBean(DBTableData dbTableData) {
this.dbTableData = dbTableData; this.dbTableData = dbTableData;

6
designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java

@ -153,9 +153,9 @@ public class PluginOperateUtils {
public void run() { public void run() {
PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo);
PluginContext plugin = PluginManager.getContext(pluginMarker); PluginContext plugin = PluginManager.getContext(pluginMarker);
boolean isRunning = plugin.isRunning(); boolean running = plugin.isRunning() || plugin.isPrepare();
PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(isRunning, jsCallback); PluginTaskCallback modifyStatusCallback = new ModifyStatusCallback(running, jsCallback);
changePluginActive(isRunning, pluginMarker, modifyStatusCallback, plugin); changePluginActive(running, pluginMarker, modifyStatusCallback, plugin);
} }
}); });
} }

4
designer-base/src/main/java/com/fr/design/extra/PluginUtils.java

@ -270,8 +270,8 @@ public class PluginUtils {
jo.put("vendor", pluginContext.getVendor()); jo.put("vendor", pluginContext.getVendor());
jo.put("price", pluginContext.getPrice()); jo.put("price", pluginContext.getPrice());
jo.put("requiredJarTime", pluginContext.getRequiredJarTime()); jo.put("requiredJarTime", pluginContext.getRequiredJarTime());
// 前端需求的active实际上是插件的运行状态,通过isRunning()获取 // 前端需求的active实际上是插件的运行状态,通过isRunning()或isPrepare()获取
jo.put("active", pluginContext.isRunning()); jo.put("active", pluginContext.isRunning() || pluginContext.isPrepare());
jo.put("hidden", pluginContext.isHidden()); jo.put("hidden", pluginContext.isHidden());
jo.put("free", pluginContext.isFree()); jo.put("free", pluginContext.isFree());
jo.put("licDamaged", pluginContext.isLicDamaged()); jo.put("licDamaged", pluginContext.isLicDamaged());

41
designer-base/src/test/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPaneTest.java

@ -0,0 +1,41 @@
package com.fr.design.data.tabledata.tabledatapane;
import com.fr.base.Parameter;
import com.fr.design.data.datapane.sqlpane.SQLEditPane;
import com.fr.invoke.Reflect;
import junit.framework.TestCase;
import org.junit.Assert;
/**
* @author Yuan.Wang
* @since 11.0
* Created on 2023/12/22
*/
public class DBTableDataPaneTest extends TestCase {
public void testGetParameters() {
DBTableDataPane pane = new DBTableDataPane();
SQLEditPane editPane = new SQLEditPane();
String sql = "select distinct 类别ID from S产品\n" +
"where 1=1\n" +
"order by 类别ID\n" +
"--${ if(len(comboBox0) = 0,\"\",\"AND 类别00ID = '\" + comboBox0 + \"'\")}";
String sql1 = "select distinct 类别ID from S产品\n" +
"where 1=1\n" +
"order by 类别ID\n" +
"${ if(len(comboBox0) = 0,\"\",\"AND 类别00ID = '\" + comboBox0 + \"'\")}";
editPane.setText(sql);
Reflect.on(pane).set("sqlTextPane", editPane);
Reflect.on(pane).set("pageQuery", sql);
Parameter[] parameters = Reflect.on(pane).call("getParameters").get();
Assert.assertEquals(0, parameters.length);
editPane.setText(sql1);
parameters = Reflect.on(pane).call("getParameters").get();
Assert.assertEquals(1, parameters.length);
Assert.assertEquals(parameters[0].getName(), "comboBox0");
}
}
Loading…
Cancel
Save