Browse Source

REPORT-131584 判重数据集名称

fbp/release
vito 3 months ago
parent
commit
d963ee47e3
  1. 4
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java
  2. 17
      designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java
  3. 40
      designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataPane.java
  4. 4
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java

4
designer-base/src/main/java/com/fr/design/data/datapane/TableDataCreatorProducer.java

@ -14,7 +14,7 @@ import com.fine.theme.icon.LazyIcon;
import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.datacenters.tabledata.DCTableData; import com.fr.datacenters.tabledata.DCTableData;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.data.tabledata.datacenter.DatacentersPane; import com.fr.design.data.tabledata.datacenter.DCTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.ClassTableDataPane; import com.fr.design.data.tabledata.tabledatapane.ClassTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane; import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.EmbeddedTableDataPane; import com.fr.design.data.tabledata.tabledatapane.EmbeddedTableDataPane;
@ -95,7 +95,7 @@ public class TableDataCreatorProducer {
return new TableDataNameObjectCreator[]{ return new TableDataNameObjectCreator[]{
new TableDataNameObjectCreator(i18nText("Fine-Design_Basic_DS_Datacenters"), new TableDataNameObjectCreator(i18nText("Fine-Design_Basic_DS_Datacenters"),
new LazyIcon("datacenter"), new LazyIcon("datacenter"),
DCTableData.class, DatacentersPane.class) { DCTableData.class, DCTableDataPane.class) {
@Override @Override
public boolean shouldInsertSeparator() { public boolean shouldInsertSeparator() {
return true; return true;

17
designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DatacentersJSBridge.java → designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataJSBridge.java

@ -4,6 +4,7 @@ import com.fr.base.BaseFormula;
import com.fr.datacenters.tabledata.bean.DCFilterQueryBean; import com.fr.datacenters.tabledata.bean.DCFilterQueryBean;
import com.fr.datacenters.tabledata.bean.DCTableDataBean; import com.fr.datacenters.tabledata.bean.DCTableDataBean;
import com.fr.datacenters.tabledata.filter.DCFilter; import com.fr.datacenters.tabledata.filter.DCFilter;
import com.fr.datacenters.tabledata.parameter.DCParameter;
import com.fr.design.bridge.exec.JSBridge; import com.fr.design.bridge.exec.JSBridge;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
@ -37,7 +38,7 @@ import java.util.stream.Collectors;
* Created on 2024/6/17 * Created on 2024/6/17
*/ */
@JsAccessible @JsAccessible
public class DatacentersJSBridge { public class DCTableDataJSBridge {
private static final String EVENT_FORMULA_UPDATE = "OK"; private static final String EVENT_FORMULA_UPDATE = "OK";
private static final String EVENT_FORMULA_CANCEL = "CANCEL"; private static final String EVENT_FORMULA_CANCEL = "CANCEL";
@ -47,25 +48,25 @@ public class DatacentersJSBridge {
* @param window js环境的window对象 * @param window js环境的window对象
* @return 桥接实例 * @return 桥接实例
*/ */
public static DatacentersJSBridge getBridge(JsObject window) { public static DCTableDataJSBridge getBridge(JsObject window) {
return new DatacentersJSBridge(window); return new DCTableDataJSBridge(window);
} }
private final JsObject window; private final JsObject window;
private DatacentersJSBridge(JsObject window) { private DCTableDataJSBridge(JsObject window) {
this.window = window; this.window = window;
} }
private static DatacentersPane relationPanel; private static DCTableDataPane relationPanel;
/** /**
* 设置窗口用于打开对话框的层级 * 设置窗口用于打开对话框的层级
* *
* @param panel 面板 * @param panel 面板
*/ */
public static void relationPanel(DatacentersPane panel) { public static void relationPanel(DCTableDataPane panel) {
relationPanel = panel; relationPanel = panel;
} }
@ -161,7 +162,9 @@ public class DatacentersJSBridge {
JxUIPane.DEFAULT_EXECUTOR.submit(() -> { JxUIPane.DEFAULT_EXECUTOR.submit(() -> {
try { try {
DCTableDataBean decoded = EmbedJson.decodeValue(tableData, DCTableDataBean.class); DCTableDataBean decoded = EmbedJson.decodeValue(tableData, DCTableDataBean.class);
DCFilter dcFilter = decoded.getFilter().evalValue(decoded.getParameters(), Calculator.createCalculator()); DCParameter[] dcParameters = Arrays.stream(decoded.getParameters())
.map(DCParameter::fromBean).toArray(DCParameter[]::new);
DCFilter dcFilter = decoded.getFilter().evalValue(dcParameters, Calculator.createCalculator());
DCFilterQueryBean queryBean = dcFilter.toQueryBean(); DCFilterQueryBean queryBean = dcFilter.toQueryBean();
String encode = EmbedJson.encode(queryBean); String encode = EmbedJson.encode(queryBean);
callback.invoke(window, encode); callback.invoke(window, encode);

40
designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DatacentersPane.java → designer-base/src/main/java/com/fr/design/data/tabledata/datacenter/DCTableDataPane.java

@ -4,6 +4,7 @@ import com.fanruan.workplace.http.ServiceType;
import com.fr.datacenters.tabledata.DCTableData; import com.fr.datacenters.tabledata.DCTableData;
import com.fr.datacenters.tabledata.bean.DCNameBean; import com.fr.datacenters.tabledata.bean.DCNameBean;
import com.fr.datacenters.tabledata.bean.DCTableDataBean; import com.fr.datacenters.tabledata.bean.DCTableDataBean;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.dialog.DialogActionListener; import com.fr.design.dialog.DialogActionListener;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
@ -14,10 +15,15 @@ import com.fr.json.revise.EmbedJson;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.third.guava.collect.ImmutableMap; import com.fr.third.guava.collect.ImmutableMap;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
import com.teamdev.jxbrowser.browser.callback.InjectJsCallback;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Window; import java.awt.Window;
import java.util.Arrays;
import static com.fr.design.ui.ModernUIConstants.DOT;
import static com.fr.design.ui.ModernUIConstants.WINDOW;
/** /**
* 数据中心数据集面板 * 数据中心数据集面板
@ -26,7 +32,7 @@ import java.awt.Window;
* @since 11.0 * @since 11.0
* Created on 2024/6/17 * Created on 2024/6/17
*/ */
public class DatacentersPane extends AbstractTableDataPane<DCTableData> { public class DCTableDataPane extends AbstractTableDataPane<DCTableData> {
private static final JxEngine JX_ENGINE = JxEngine.newInstance(false); private static final JxEngine JX_ENGINE = JxEngine.newInstance(false);
@ -37,31 +43,7 @@ public class DatacentersPane extends AbstractTableDataPane<DCTableData> {
// 用于复制粘贴场景 // 用于复制粘贴场景
private DCTableData dcTableData; private DCTableData dcTableData;
/** public DCTableDataPane() {
* 借用只运行一次
*/
private void addDialogActionListener() {
// 保证在窗口加载完成后执行
SwingUtilities.invokeLater(() -> {
Window ancestor = SwingUtilities.getWindowAncestor(DatacentersPane.this);
if (ancestor instanceof UIDialog) {
((UIDialog) ancestor).addDialogActionListener(new DialogActionListener() {
@Override
public void doOk() {
dataCenterJxUIPane.disposeBrowser();
}
@Override
public void doCancel() {
dataCenterJxUIPane.disposeBrowser();
}
});
}
});
}
public DatacentersPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
dataCenterJxUIPane = getJxUIPane(); dataCenterJxUIPane = getJxUIPane();
add(dataCenterJxUIPane, BorderLayout.CENTER); add(dataCenterJxUIPane, BorderLayout.CENTER);
@ -73,7 +55,7 @@ public class DatacentersPane extends AbstractTableDataPane<DCTableData> {
return new JxUIPane.Builder<String>() return new JxUIPane.Builder<String>()
.engine(JX_ENGINE) .engine(JX_ENGINE)
.namespace(DATA_CENTER) .namespace(DATA_CENTER)
.bindWindow(DATA_CENTER_HELPER, DatacentersJSBridge::getBridge) .bindWindow(DATA_CENTER_HELPER, DCTableDataJSBridge::getBridge)
.withEMB("com/fr/design/data/tabledata/datacenter/web/data-choose.prod.html", .withEMB("com/fr/design/data/tabledata/datacenter/web/data-choose.prod.html",
ImmutableMap.of("fineServletURL", getDatacentersUrl())) ImmutableMap.of("fineServletURL", getDatacentersUrl()))
.build(); .build();
@ -96,9 +78,11 @@ public class DatacentersPane extends AbstractTableDataPane<DCTableData> {
@Override @Override
public void populateBean(DCTableData ob) { public void populateBean(DCTableData ob) {
DatacentersJSBridge.relationPanel(this); DCTableDataJSBridge.relationPanel(this);
dcTableData = ob; dcTableData = ob;
dataCenterJxUIPane.populate(EmbedJson.encode(ob.toBean())); dataCenterJxUIPane.populate(EmbedJson.encode(ob.toBean()));
String[] allDSNames = DesignTableDataManager.getAllDSNames(DesignTableDataManager.getEditingTableDataSource());
dataCenterJxUIPane.executeJS(DATA_CENTER + DOT + "datasetNames=" + EmbedJson.encode(allDSNames));
} }

4
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java

@ -15,7 +15,7 @@ import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.datacenters.tabledata.DCTableData; import com.fr.datacenters.tabledata.DCTableData;
import com.fr.decision.webservice.bean.dataset.ServerDataSetBean; import com.fr.decision.webservice.bean.dataset.ServerDataSetBean;
import com.fr.design.data.datapane.TableDataNameObjectCreator; import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.data.tabledata.datacenter.DatacentersPane; import com.fr.design.data.tabledata.datacenter.DCTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.ClassTableDataPane; import com.fr.design.data.tabledata.tabledatapane.ClassTableDataPane;
import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane; import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane;
@ -79,7 +79,7 @@ public abstract class TableDataFactory {
i18nText("Fine-Design_Basic_DS_Datacenters"), i18nText("Fine-Design_Basic_DS_Datacenters"),
new LazyIcon("datacenter"), new LazyIcon("datacenter"),
DCTableData.class, DCTableData.class,
DatacentersPane.class)); DCTableDataPane.class));
map.putAll(defaultMap); map.putAll(defaultMap);
} }

Loading…
Cancel
Save