Browse Source

Merge pull request #1306 in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit '9daf000d59be72c07c6431d800079dbe0def7925':
  fix
  REPORT-24176 设计器 数据字典问题
feature/big-screen
Hades 5 years ago
parent
commit
8062ea94f4
  1. 29
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  2. 28
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java
  3. 7
      designer-base/src/main/java/com/fr/design/present/DictPresentPane.java
  4. 8
      designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java
  5. 8
      designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java
  6. 1
      designer-realize/src/main/java/com/fr/design/present/PresentPane.java

29
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -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的所有字段
*

28
designer-base/src/main/java/com/fr/design/data/datapane/TableDataComboBox.java

@ -34,6 +34,7 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC
private static final long serialVersionUID = 1L;
private boolean refresModel = false;
private String treeName; //树数据集本身的名字
private ChangeListener changeListener;
public TableDataComboBox(TableDataSource source){
this(source,StringUtils.EMPTY);
@ -136,15 +137,22 @@ public class TableDataComboBox extends UIComboBox implements Prepare4DataSourceC
}
}
/**
*注册listener,相应数据集改变
*/
public void registerDSChangeListener() {
DesignTableDataManager.addDsChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
TableDataComboBox.this.refresh(DesignTableDataManager.getEditingTableDataSource());
}
});
}
/**
*注册listener,相应数据集改变
*/
@Override
public void registerDSChangeListener() {
changeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
TableDataComboBox.this.refresh(DesignTableDataManager.getEditingTableDataSource());
}
};
DesignTableDataManager.addDsChangeListener(changeListener);
}
public void registerGlobalDSChangeListener() {
DesignTableDataManager.addGlobalDsChangeListener(changeListener);
}
}

7
designer-base/src/main/java/com/fr/design/present/DictPresentPane.java

@ -5,6 +5,7 @@ import java.awt.event.ItemListener;
import com.fr.base.present.DictPresent;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.data.tabledata.Prepare4DataSourceChange;
import com.fr.design.present.dict.DictionaryPane;
@ -13,7 +14,7 @@ import com.fr.design.present.dict.DictionaryPane;
* @author zhou
* @since 2012-5-31上午10:54:20
*/
public class DictPresentPane extends FurtherBasicBeanPane<DictPresent> {
public class DictPresentPane extends FurtherBasicBeanPane<DictPresent> implements Prepare4DataSourceChange {
private DictionaryPane dictionaryPane;
public DictPresentPane() {
@ -50,4 +51,8 @@ public class DictPresentPane extends FurtherBasicBeanPane<DictPresent> {
dictionaryPane.reset();
}
@Override
public void registerDSChangeListener() {
dictionaryPane.registerDSChangeListener();
}
}

8
designer-base/src/main/java/com/fr/design/present/dict/DictionaryPane.java

@ -5,6 +5,7 @@ import com.fr.data.impl.DynamicSQLDict;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.data.DataCreatorUI;
import com.fr.design.data.tabledata.Prepare4DataSourceChange;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
@ -20,7 +21,7 @@ import java.util.List;
* @author zhou
* @since 2012-5-31下午12:20:41
*/
public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCreatorUI {
public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCreatorUI, Prepare4DataSourceChange {
private TableDataDictPane tableDataDictPane;
@Override
@ -77,4 +78,9 @@ public class DictionaryPane extends UIComboBoxPane<Dictionary> implements DataCr
paneList.add(new FormulaDictPane());
return paneList;
}
@Override
public void registerDSChangeListener() {
tableDataDictPane.registerDSChangeListener();
}
}

8
designer-base/src/main/java/com/fr/design/present/dict/TableDataDictPane.java

@ -16,6 +16,7 @@ import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.data.datapane.preview.PreviewLabel;
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable;
import com.fr.design.data.tabledata.Prepare4DataSourceChange;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper;
import com.fr.design.editor.DoubleDeckValueEditorPane;
@ -48,7 +49,7 @@ import java.util.List;
* @editor zhou
* @since 2012-3-29下午1:49:24
*/
public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> implements Previewable, UIObserver {
public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> implements Previewable, UIObserver, Prepare4DataSourceChange {
private static final int BEGIN = 1;
private static final int END = 10;
private static final int VGAP = 24;
@ -368,4 +369,9 @@ public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary>
public boolean shouldResponseChangeListener() {
return true;
}
@Override
public void registerDSChangeListener() {
tableDataNameComboBox.registerGlobalDSChangeListener();
}
}

1
designer-realize/src/main/java/com/fr/design/present/PresentPane.java

@ -75,6 +75,7 @@ public class PresentPane extends UIComboBoxPane<Present> {
displays.add(none.title4PopupWindow());
dictPresentPane = new DictPresentPane();
dictPresentPane.registerDSChangeListener();
paneList.add(dictPresentPane);
keys.add(DictPresent.class.getName());
displays.add(dictPresentPane.title4PopupWindow());

Loading…
Cancel
Save