Browse Source

REPORT-138249 cpt支持数据集替换 提出预览接口

release/11.0
Destiny.Lin 2 weeks ago
parent
commit
62f74da6f1
  1. 113
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  2. 2
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

113
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -442,64 +442,73 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
if (selectedNO != null) { if (selectedNO != null) {
data = selectedNO.getObject(); data = selectedNO.getObject();
} }
try { preview((TableDataWrapper) data, BasicTableDataTreePane.this);
if (((TableDataWrapper) Objects.requireNonNull(data)).getTableData() instanceof MultiResultTableData) { }
((MultiResultTableData<?>) (((TableDataWrapper) data).getTableData())).resetDataModelList(); }
if (data instanceof MultiResultTableDataWrapper) {
MultiResultTableDataWrapper oldSdw = ((MultiResultTableDataWrapper) data);
MultiResultTableDataWrapper newSdw = new MultiResultTableDataWrapper((MultiResultTableData<?>) oldSdw.getTableData(), oldSdw.getMultiResultTableDataName(), oldSdw.getTableDataName());
newSdw.previewData(MultiResultTableDataWrapper.PREVIEW_ONE);
} else {
MultiResultTableData<?> tableData = (MultiResultTableData<?>) ((TableDataWrapper) data).getTableData();
MultiResultTableDataWrapper storeProcedureDataWrapper = new MultiResultTableDataWrapper(tableData, StringUtils.EMPTY, StringUtils.EMPTY);
storeProcedureDataWrapper.previewData(MultiResultTableDataWrapper.PREVIEW_ALL);
}
} else {
TableDataWrapper wrapper = ((TableDataWrapper) data);
if (TableDataAuthHelper.needCheckAuthWhenEdit(wrapper.getTableData())) {
// 先打开一个Loading面板
TableDataLoadingPane loadingPane = new TableDataLoadingPane();
BasicDialog loadingDialog = loadingPane.showLargeWindow(SwingUtilities.getWindowAncestor(BasicTableDataTreePane.this), null);
// 查询权限
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
// 获取无权限连接名称集合
Collection<String> noAuthConnections = TableDataAuthHelper.getNoAuthConnections();
// 获取当前数据集对应的数据连接名称
String connectionName = TableDataAuthHelper.getConnectionNameByDBTableData((DBTableData) wrapper.getTableData());
return !noAuthConnections.contains(connectionName);
}
@Override /**
protected void done() { * 预览数据集
try { *
Boolean hasAuth = get(); * @param data TableDataWrapper
if (hasAuth) { * @param c 底层面板
// 有权限时,关闭Loading面板,打开编辑面板 */
loadingDialog.setVisible(false); public static void preview(TableDataWrapper data, Component c) {
wrapper.previewData(); try {
} else { if (((TableDataWrapper) Objects.requireNonNull(data)).getTableData() instanceof MultiResultTableData) {
// 无权限时,给出无权限提示 ((MultiResultTableData<?>) (((TableDataWrapper) data).getTableData())).resetDataModelList();
loadingPane.switchTo(TableDataLoadingPane.NO_AUTH_PANE_NAME); if (data instanceof MultiResultTableDataWrapper) {
} MultiResultTableDataWrapper oldSdw = ((MultiResultTableDataWrapper) data);
} catch (Exception e) { MultiResultTableDataWrapper newSdw = new MultiResultTableDataWrapper((MultiResultTableData<?>) oldSdw.getTableData(), oldSdw.getMultiResultTableDataName(), oldSdw.getTableDataName());
FineLoggerFactory.getLogger().error("loading connection error in remote design", e.getMessage()); newSdw.previewData(MultiResultTableDataWrapper.PREVIEW_ONE);
// 查询权限失败时,给出报错提示 } else {
loadingPane.switchTo(TableDataLoadingPane.ERROR_NAME); MultiResultTableData<?> tableData = (MultiResultTableData<?>) ((TableDataWrapper) data).getTableData();
MultiResultTableDataWrapper storeProcedureDataWrapper = new MultiResultTableDataWrapper(tableData, StringUtils.EMPTY, StringUtils.EMPTY);
storeProcedureDataWrapper.previewData(MultiResultTableDataWrapper.PREVIEW_ALL);
}
} else {
TableDataWrapper wrapper = ((TableDataWrapper) data);
if (TableDataAuthHelper.needCheckAuthWhenEdit(wrapper.getTableData())) {
// 先打开一个Loading面板
TableDataLoadingPane loadingPane = new TableDataLoadingPane();
BasicDialog loadingDialog = loadingPane.showLargeWindow(SwingUtilities.getWindowAncestor(c), null);
// 查询权限
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
// 获取无权限连接名称集合
Collection<String> noAuthConnections = TableDataAuthHelper.getNoAuthConnections();
// 获取当前数据集对应的数据连接名称
String connectionName = TableDataAuthHelper.getConnectionNameByDBTableData((DBTableData) wrapper.getTableData());
return !noAuthConnections.contains(connectionName);
}
@Override
protected void done() {
try {
Boolean hasAuth = get();
if (hasAuth) {
// 有权限时,关闭Loading面板,打开编辑面板
loadingDialog.setVisible(false);
wrapper.previewData();
} else {
// 无权限时,给出无权限提示
loadingPane.switchTo(TableDataLoadingPane.NO_AUTH_PANE_NAME);
} }
} catch (Exception e) {
FineLoggerFactory.getLogger().error("loading connection error in remote design", e.getMessage());
// 查询权限失败时,给出报错提示
loadingPane.switchTo(TableDataLoadingPane.ERROR_NAME);
} }
}.execute(); }
loadingDialog.setVisible(true); }.execute();
} else { loadingDialog.setVisible(true);
wrapper.previewData(); } else {
} wrapper.previewData();
} }
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
} }
} catch (Exception ex) {
FineLoggerFactory.getLogger().error(ex.getMessage(), ex);
} }
} }

2
designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java

@ -100,6 +100,7 @@ import java.util.Set;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
public class TableDataTreePane extends BasicTableDataTreePane { public class TableDataTreePane extends BasicTableDataTreePane {
private static Set<AbstractExtraAction> extraActions = new HashSet<>();
private static final TableDataTreePane singleton = new TableDataTreePane(); private static final TableDataTreePane singleton = new TableDataTreePane();
public static final int PLUGIN_LISTENER_PRIORITY = 1; public static final int PLUGIN_LISTENER_PRIORITY = 1;
@ -147,7 +148,6 @@ public class TableDataTreePane extends BasicTableDataTreePane {
private EsdOffAction esdOffAction; private EsdOffAction esdOffAction;
private SwitchAction switchAction; private SwitchAction switchAction;
private PreviewTableDataAction previewTableDataAction; private PreviewTableDataAction previewTableDataAction;
private static Set<AbstractExtraAction> extraActions = new HashSet<>();
private JPanel serverDatasetAuthTipJPanel = new JPanel(); private JPanel serverDatasetAuthTipJPanel = new JPanel();
private TableDataSearchRemindPane remindPane; private TableDataSearchRemindPane remindPane;

Loading…
Cancel
Save