|
|
|
@ -20,7 +20,7 @@ import com.fr.design.data.tabledata.wrapper.TableDataFactory;
|
|
|
|
|
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; |
|
|
|
|
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; |
|
|
|
|
import com.fr.design.dialog.DialogActionAdapter; |
|
|
|
|
import com.fr.design.file.HistoryTemplateListPane; |
|
|
|
|
import com.fr.design.file.HistoryTemplateListCache; |
|
|
|
|
import com.fr.design.gui.iprogressbar.AutoProgressBar; |
|
|
|
|
import com.fr.design.mainframe.DesignerContext; |
|
|
|
|
import com.fr.design.mainframe.JTemplate; |
|
|
|
@ -73,7 +73,7 @@ public abstract class DesignTableDataManager {
|
|
|
|
|
*/ |
|
|
|
|
private static java.util.Map<String, TableDataWrapper> globalDsCache = new java.util.HashMap<String, TableDataWrapper>(); |
|
|
|
|
private static java.util.Map<String, String> dsNameChangedMap = new HashMap<String, String>(); |
|
|
|
|
// private static List<ChangeListener> dsListeners = new ArrayList<ChangeListener>();
|
|
|
|
|
private static List<ChangeListener> globalDsListeners = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
private static Map<String, List<ChangeListener>> dsListenersMap = new HashMap<String, List<ChangeListener>>(); |
|
|
|
|
|
|
|
|
@ -95,15 +95,19 @@ public abstract class DesignTableDataManager {
|
|
|
|
|
* 响应数据集改变. |
|
|
|
|
*/ |
|
|
|
|
private static void fireDsChanged() { |
|
|
|
|
fireDsChanged(globalDsListeners); |
|
|
|
|
for (Entry<String, List<ChangeListener>> listenerEntry : dsListenersMap.entrySet()) { |
|
|
|
|
List<ChangeListener> dsListeners = listenerEntry.getValue(); |
|
|
|
|
for (int i = 0; i < dsListeners.size(); i++) { |
|
|
|
|
//增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener),
|
|
|
|
|
// 由于dsListeners是arraylist, 此时会ConcurrentModifyException
|
|
|
|
|
// for (ChangeListener l : dsListeners) {
|
|
|
|
|
ChangeEvent e = null; |
|
|
|
|
dsListeners.get(i).stateChanged(e); |
|
|
|
|
} |
|
|
|
|
fireDsChanged(dsListeners); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void fireDsChanged(List<ChangeListener> dsListeners) { |
|
|
|
|
for (int i = 0; i < dsListeners.size(); i++) { |
|
|
|
|
//增强for循环用的iterator实现的, 如果中间哪个listener修改或删除了(如ChartEditPane.dsChangeListener),
|
|
|
|
|
// 由于dsListeners是arraylist, 此时会ConcurrentModifyException
|
|
|
|
|
ChangeEvent e = null; |
|
|
|
|
dsListeners.get(i).stateChanged(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -160,13 +164,17 @@ public abstract class DesignTableDataManager {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static void addGlobalDsChangeListener(ChangeListener l) { |
|
|
|
|
globalDsListeners.add(l); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 添加模板数据集改变 监听事件. |
|
|
|
|
* |
|
|
|
|
* @param l ChangeListener监听器 |
|
|
|
|
*/ |
|
|
|
|
public static void addDsChangeListener(ChangeListener l) { |
|
|
|
|
JTemplate<?, ?> template = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); |
|
|
|
|
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
|
|
|
|
String key = StringUtils.EMPTY; |
|
|
|
|
if (template != null) { |
|
|
|
|
key = template.getPath(); |
|
|
|
@ -178,7 +186,6 @@ public abstract class DesignTableDataManager {
|
|
|
|
|
} |
|
|
|
|
dsListeners.add(l); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取数据源source中dsName的所有字段 |
|
|
|
|
* |
|
|
|
|