|
|
|
@ -36,7 +36,6 @@ import java.io.ByteArrayOutputStream;
|
|
|
|
|
import java.text.Collator; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.Map.Entry; |
|
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 设计器管理操作数据集的类: |
|
|
|
@ -319,7 +318,6 @@ public abstract class DesignTableDataManager {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void addStoreProcedureData(java.util.Map<String, TableDataWrapper> resMap) { |
|
|
|
|
DatasourceManagerProvider mgr = DatasourceManager.getProviderInstance(); |
|
|
|
|
String[] namearray = new String[0]; |
|
|
|
@ -381,12 +379,10 @@ public abstract class DesignTableDataManager {
|
|
|
|
|
private static EmbeddedTableData previewTableData(TableData tabledata, int rowCount, boolean isMustInputParameters, boolean needLoadingBar) throws Exception { |
|
|
|
|
final AutoProgressBar loadingBar = PreviewTablePane.getInstance().getProgressBar(); |
|
|
|
|
Env currentEnv = FRContext.getCurrentEnv(); |
|
|
|
|
EmbeddedTableData embeddedTableData = null; |
|
|
|
|
ParameterProvider[] parameters = currentEnv.getTableDataParameters(tabledata); |
|
|
|
|
boolean isNullParameter = parameters == null || parameters.length == 0; |
|
|
|
|
if (isNullOrEmpty(parameters)) { |
|
|
|
|
ParameterProvider[] tableDataParameter = tabledata.getParameters(Calculator.createCalculator()); |
|
|
|
|
boolean isOriginalNUllParameter = tableDataParameter == null || tableDataParameter.length == 0; |
|
|
|
|
if (isNullParameter && !isOriginalNUllParameter) { |
|
|
|
|
checkArgument(!isNullOrEmpty(tableDataParameter), "both parameters and tableDataParameter are empty"); |
|
|
|
|
parameters = tableDataParameter; |
|
|
|
|
} |
|
|
|
|
boolean hasValue = true; |
|
|
|
@ -396,25 +392,24 @@ public abstract class DesignTableDataManager {
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
final Map<String, Object> parameterMap = new HashMap<String, Object>(); |
|
|
|
|
final Map<String, Object> parameterMap = new HashMap<>(); |
|
|
|
|
if (!hasValue || isMustInputParameters) { |
|
|
|
|
if (parameters != null && parameters.length > 0) { |
|
|
|
|
final ParameterInputPane pPane = new ParameterInputPane(parameters); |
|
|
|
|
pPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void doOk() { |
|
|
|
|
parameterMap.putAll(pPane.update()); |
|
|
|
|
} |
|
|
|
|
}).setVisible(true); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
for (int i = 0; i < parameters.length; i++) { |
|
|
|
|
parameterMap.put(parameters[i].getName(), parameters[i].getValue()); |
|
|
|
|
for (ParameterProvider parameter : parameters) { |
|
|
|
|
parameterMap.put(parameter.getName(), parameter.getValue()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (loadingBar != null && needLoadingBar) { |
|
|
|
|
loadingBar.start(); |
|
|
|
|
} |
|
|
|
|
EmbeddedTableData embeddedTableData = null; |
|
|
|
|
try { |
|
|
|
|
for (ParameterProvider parameter : currentEnv.getTableDataParameters(tabledata)) { |
|
|
|
|
if (parameterMap.containsKey(parameter.getName())) { |
|
|
|
@ -501,5 +496,13 @@ public abstract class DesignTableDataManager {
|
|
|
|
|
threadLocal.set(value); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static boolean isNullOrEmpty(Object[] objs) { |
|
|
|
|
return objs == null || objs.length == 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void checkArgument(boolean expression, String errorMessage) { |
|
|
|
|
if (!expression) { |
|
|
|
|
throw new IllegalArgumentException(errorMessage); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |