|
|
|
@ -9,6 +9,7 @@ import com.fr.design.ExtraDesignClassManager;
|
|
|
|
|
import com.fr.design.actions.UpdateAction; |
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
|
import com.fr.design.data.BasicTableDataTreePane; |
|
|
|
|
import com.fr.design.data.BasicTableDataUtils; |
|
|
|
|
import com.fr.design.data.DesignTableDataManager; |
|
|
|
|
import com.fr.design.data.tabledata.StoreProcedureWorkerListener; |
|
|
|
|
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; |
|
|
|
@ -59,7 +60,7 @@ import java.util.Map;
|
|
|
|
|
|
|
|
|
|
public class TableDataTreePane extends BasicTableDataTreePane { |
|
|
|
|
private static TableDataTreePane singleton = new TableDataTreePane(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static final int PLUGIN_LISTENER_PRIORITY = 1; |
|
|
|
|
|
|
|
|
|
public synchronized static BasicTableDataTreePane getInstance(DesignModelAdapter<?, ?> tc) { |
|
|
|
@ -96,10 +97,10 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
addMenuDef.setIconPath(IconPathConstants.ADD_POPMENU_ICON_PATH); |
|
|
|
|
|
|
|
|
|
createAddMenuDef(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 创建插件监听
|
|
|
|
|
createPluginListener(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editAction = new EditAction(); |
|
|
|
|
removeAction = new RemoveAction(); |
|
|
|
|
previewTableDataAction = new PreviewTableDataAction(dataTree); |
|
|
|
@ -139,27 +140,27 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
new TableDataTreeDragSource(dataTree, DnDConstants.ACTION_COPY); |
|
|
|
|
checkButtonEnabled(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void createPluginListener() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//菜单栏监听
|
|
|
|
|
GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void on(PluginEvent event) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
addMenuDef.clearShortCuts(); |
|
|
|
|
createAddMenuDef(); |
|
|
|
|
} |
|
|
|
|
}, new PluginFilter() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public boolean accept(PluginContext context) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return context.contain(PluginModule.ExtraDesign); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//监听数据集插件
|
|
|
|
|
GeneralContext.listenPluginRunningChanged(new PluginEventListener() { |
|
|
|
|
@Override |
|
|
|
@ -188,8 +189,8 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void checkButtonEnabled() { |
|
|
|
|
super.checkButtonEnabled(editAction, previewTableDataAction, removeAction, op, dataTree); |
|
|
|
|
} |
|
|
|
@ -339,10 +340,11 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 合并数据集 |
|
|
|
|
* @param srcName 数据集来源(比如报表块,就是报表块的名称) |
|
|
|
|
* |
|
|
|
|
* @param srcName 数据集来源(比如报表块,就是报表块的名称) |
|
|
|
|
* @param tableDataSource 数据集 |
|
|
|
|
*/ |
|
|
|
|
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) { |
|
|
|
|
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource, boolean isCover) { |
|
|
|
|
Map<String, String> tdNameMap = new HashMap<>(); |
|
|
|
|
allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); |
|
|
|
|
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); |
|
|
|
@ -352,14 +354,8 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
String tdName = (String) tdIterator.next(); |
|
|
|
|
String oldName = tdName; |
|
|
|
|
TableData td = tableDataSource.getTableData(tdName); |
|
|
|
|
if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称
|
|
|
|
|
tdName = srcName + tdName; |
|
|
|
|
} |
|
|
|
|
int i = 0; |
|
|
|
|
while (tds.getTableData(tdName) != null) { |
|
|
|
|
i++;//如果拼上名字后依然已经存在就加编号
|
|
|
|
|
tdName += i; |
|
|
|
|
} |
|
|
|
|
boolean isDsNameRepeaded = isDsNameRepeaded(tdName); |
|
|
|
|
tdName = BasicTableDataUtils.getTableDataName(isCover, tds, tdName, srcName, isDsNameRepeaded); |
|
|
|
|
tds.putTableData(tdName, td); |
|
|
|
|
if (!ComparatorUtils.equals(oldName, tdName)) { |
|
|
|
|
tdNameMap.put(oldName, tdName); |
|
|
|
@ -367,8 +363,19 @@ public class TableDataTreePane extends BasicTableDataTreePane {
|
|
|
|
|
} |
|
|
|
|
tc.parameterChanged(); |
|
|
|
|
dataTree.refresh(); |
|
|
|
|
return Collections.unmodifiableMap(tdNameMap); |
|
|
|
|
return Collections.unmodifiableMap(tdNameMap); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void removeTableData(String sourceName) { |
|
|
|
|
TableDataSource tds = tc.getBook(); |
|
|
|
|
tds.removeTableData(sourceName); |
|
|
|
|
dataTree.refresh(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void addDataPane(final AbstractTableDataPane<?> uPanel, String paneName) { |
|
|
|
|
final NamePane nPanel = uPanel.asNamePane(); |
|
|
|
|
nPanel.setObjectName(paneName); |
|
|
|
|