Browse Source

REPORT-6868 设计器数据列单元格切换频繁弹出sql参数对话框

master
yaoh.wu 7 years ago
parent
commit
5c7c5acef3
  1. 36
      designer-base/src/com/fr/design/gui/demo/ComboBoxDemo.java
  2. 15
      designer-base/src/com/fr/design/gui/demo/SwingComponentsDemo.java
  3. 140
      designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java
  4. 44
      designer-base/src/com/fr/design/gui/icombobox/UIComboBox.java
  5. 130
      designer-realize/src/com/fr/design/dscolumn/DSColumnPane.java

36
designer-base/src/com/fr/design/gui/demo/ComboBoxDemo.java

@ -1,34 +1,37 @@
package com.fr.design.gui.demo; package com.fr.design.gui.demo;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
import javax.swing.DefaultListCellRenderer;
import com.fr.design.gui.ilable.UILabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.ListCellRenderer;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.gui.icombobox.filter.Filter; import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.icombobox.ComboCheckBox; import com.fr.design.gui.icombobox.ComboCheckBox;
import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.DictionaryComboBox;
import com.fr.design.gui.icombobox.ExtendedComboBox; import com.fr.design.gui.icombobox.ExtendedComboBox;
import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.FRTreeComboBox;
import com.fr.design.gui.icombobox.FilterComboBox; import com.fr.design.gui.icombobox.FilterComboBox;
import com.fr.design.gui.icombobox.LazyComboBox; import com.fr.design.gui.icombobox.LazyComboBox;
import com.fr.design.gui.icombobox.filter.Filter;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.parameter.ParameterInputPane;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTree;
import javax.swing.ListCellRenderer;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: Richer * User: Richer
@ -165,6 +168,7 @@ public class ComboBoxDemo extends JPanel {
// 睡5秒 // 睡5秒
try { try {
Thread.sleep(5000); Thread.sleep(5000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
FRContext.getLogger().error(e.getMessage(), e); FRContext.getLogger().error(e.getMessage(), e);
} }

15
designer-base/src/com/fr/design/gui/demo/SwingComponentsDemo.java

@ -1,16 +1,15 @@
package com.fr.design.gui.demo; package com.fr.design.gui.demo;
import java.awt.BorderLayout; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTabbedPane; import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
import java.awt.BorderLayout;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -19,8 +18,8 @@ import com.fr.design.utils.gui.GUICoreUtils;
* Time: 下午4:54 * Time: 下午4:54
*/ */
public class SwingComponentsDemo extends JFrame { public class SwingComponentsDemo extends JFrame {
public SwingComponentsDemo() { private SwingComponentsDemo() {
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
init(); init();
JPanel contentPane = (JPanel) getContentPane(); JPanel contentPane = (JPanel) getContentPane();
contentPane.setLayout(FRGUIPaneFactory.createBorderLayout()); contentPane.setLayout(FRGUIPaneFactory.createBorderLayout());
@ -40,12 +39,12 @@ public class SwingComponentsDemo extends JFrame {
public static void main(String[] args) { public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() { public void run() {
JFrame f = new SwingComponentsDemo(); JFrame f = new SwingComponentsDemo();
f.setSize(500, 500); f.setSize(500, 500);
f.setVisible(true); f.setVisible(true);
GUICoreUtils.centerWindow(f); GUICoreUtils.centerWindow(f);
f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
} }
}); });
} }

140
designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java

@ -3,108 +3,115 @@
*/ */
package com.fr.design.gui.icombobox; package com.fr.design.gui.icombobox;
import java.awt.Dimension; import com.fr.general.FRLogger;
import java.util.ArrayList; import com.fr.general.Inter;
import java.util.List;
import javax.swing.*; import javax.swing.DefaultComboBoxModel;
import javax.swing.SwingWorker;
import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener; import javax.swing.event.DocumentListener;
import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener; import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.basic.BasicComboPopup; import java.awt.Dimension;
import java.util.concurrent.ExecutionException;
import com.fr.general.Inter;
/** /**
* @author richer * @author richer
* @version 2018年2月6日14点43分 by @yaoh.wu
* @since 6.5.5 创建于2011-6-15 延迟加载的下拉框 * @since 6.5.5 创建于2011-6-15 延迟加载的下拉框
*/ */
public abstract class LazyComboBox extends UIComboBox implements PopupMenuListener { public abstract class LazyComboBox extends UIComboBox implements PopupMenuListener {
protected boolean loaded = false;
private List<EventListener> ls = new ArrayList<EventListener>();
private Object initialSelected = null;
private static final int NUM = 80; private static final int NUM = 80;
private static final String[] PENDING_CONTENT = new String[]{"", Inter.getLocText("Loading") + "..."};
public static final Object PENDING = new Object() { /**
* 是否加载完成
*/
protected boolean loaded = false;
/**
* 初始化选项
*/
private Object initialSelected = null;
@Override
public String toString() {
return Inter.getLocText("Loading") + "...";
}
};
public LazyComboBox() { protected LazyComboBox() {
super(); super();
this.setEditor(new FilterComboBoxEditor()); this.setEditor(new FilterComboBoxEditor());
addPopupMenuListener(this); addPopupMenuListener(this);
// updateUI();
} }
public void setLoaded(boolean loaded) { public void setLoaded(boolean loaded) {
this.loaded = loaded; this.loaded = loaded;
} }
/**
* 加载下拉框中的选项
*
* @return 下拉框中的选项
*/
public abstract Object[] load(); public abstract Object[] load();
@Override
public void setSelectedItem(Object anObject) { public void setSelectedItem(Object anObject) {
initialSelected = anObject; initialSelected = anObject;
if (loaded) { if (loaded) {
super.setSelectedItem(anObject); super.setSelectedItem(anObject);
} else { } else {
this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject}));
setModel(new DefaultComboBoxModel(new Object[] { anObject }));
super.setSelectedItem(anObject); super.setSelectedItem(anObject);
} }
} }
/**
* 通过调用该方法在点击下拉框按钮之前就加载好数据
*/
public void loadInstant() {
if (loaded) {
return;
}
setModel(new DefaultComboBoxModel(load()));
loaded = true;
}
@Override @Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
if (loaded) { if (loaded) {
return; return;
} }
DefaultComboBoxModel loadingModel = new DefaultComboBoxModel(new String[]{"", Inter.getLocText("Loading") + "..."}); DefaultComboBoxModel<String> loadingModel = new DefaultComboBoxModel<>(PENDING_CONTENT);
LazyComboBox.this.setModel(loadingModel); this.setModel(loadingModel);
new SwingWorker<Void, Void>() { new SwingWorker<Object[], Void>() {
@Override @Override
protected Void doInBackground() throws Exception { protected Object[] doInBackground() {
final Object selectedObj = getSelectedItem(); return load();
loadList();
return null;
} }
@Override @Override
public void done() { public void done() {
LazyComboBox.this.updateUI(); try {
LazyComboBox.this.fireEvent(); LazyComboBox.this.loadList(get());
} catch (InterruptedException | ExecutionException exception) {
FRLogger.getLogger().debug(exception.getMessage());
}
LazyComboBox.this.showPopup(); LazyComboBox.this.showPopup();
} }
}.execute(); }.execute();
}
/**
* 加载下拉列表
*/
public void loadList() {
DefaultComboBoxModel<Object> model = new DefaultComboBoxModel<>(load());
model.setSelectedItem(initialSelected);
this.setModel(model);
this.selectedItemReminder = initialSelected;
loaded = true;
} }
/** /**
* 计算加载下拉列表 * 加载下拉列表
*
* @param contents 下拉列表内容
*/ */
public void loadList() { private void loadList(Object[] contents) {
DefaultComboBoxModel model = new DefaultComboBoxModel(load()); DefaultComboBoxModel<Object> model = new DefaultComboBoxModel<>(contents);
model.setSelectedItem(initialSelected); model.setSelectedItem(initialSelected);
LazyComboBox.this.setModel(model); this.setModel(model);
LazyComboBox.this.selectedItemReminder = initialSelected ; this.selectedItemReminder = initialSelected;
loaded = true; loaded = true;
} }
@ -118,19 +125,6 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
} }
public void addClickListener(EventListener l) {
if (ls == null) {
ls = new ArrayList<LazyComboBox.EventListener>();
}
ls.add(l);
}
public void fireEvent() {
for (int i = 0, n = ls.size(); i < n; i++) {
ls.get(i).fireEvent();
}
}
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize(); Dimension dim = super.getPreferredSize();
@ -138,26 +132,6 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
return dim; return dim;
} }
private static class LazyPopMenu extends BasicComboPopup {
public LazyPopMenu(final JComboBox combo) {
super(combo);
LazyComboBox comboc = (LazyComboBox) combo;
comboc.addClickListener(new EventListener() {
@Override
public void fireEvent() {
LazyPopMenu.this.show();
combo.showPopup();
}
});
}
}
private interface EventListener {
void fireEvent();
}
class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener { class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener {
private Object item; private Object item;
private volatile boolean filtering = false; private volatile boolean filtering = false;
@ -168,12 +142,12 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
textField.getDocument().addDocumentListener(this); textField.getDocument().addDocumentListener(this);
} }
@Override
public void setItem(Object item) { public void setItem(Object item) {
if (filtering) { if (filtering) {
return; return;
} }
this.item = item; this.item = item;
this.setting = true; this.setting = true;
textField.setSetting(true); textField.setSetting(true);
String newText = (item == null) ? "" : item.toString(); String newText = (item == null) ? "" : item.toString();
@ -182,23 +156,27 @@ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListen
this.setting = false; this.setting = false;
} }
@Override
public Object getItem() { public Object getItem() {
return this.item; return this.item;
} }
@Override
public void insertUpdate(DocumentEvent e) { public void insertUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
@Override
public void removeUpdate(DocumentEvent e) { public void removeUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
@Override
public void changedUpdate(DocumentEvent e) { public void changedUpdate(DocumentEvent e) {
handleChange(); handleChange();
} }
protected void handleChange() { void handleChange() {
if (setting) { if (setting) {
return; return;
} }

44
designer-base/src/com/fr/design/gui/icombobox/UIComboBox.java

@ -4,12 +4,13 @@ import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver; import com.fr.design.event.GlobalNameObserver;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
import com.fr.design.event.UIObserverListener; import com.fr.design.event.UIObserverListener;
import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.*; import javax.swing.ComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.ListCellRenderer;
import javax.swing.plaf.ComboBoxUI; import javax.swing.plaf.ComboBoxUI;
import javax.swing.plaf.basic.ComboPopup; import javax.swing.plaf.basic.ComboPopup;
import java.awt.*; import java.awt.Dimension;
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -112,8 +113,6 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
public void setRenderer(ListCellRenderer aRenderer) { public void setRenderer(ListCellRenderer aRenderer) {
if (aRenderer instanceof UIComboBoxRenderer) { if (aRenderer instanceof UIComboBoxRenderer) {
super.setRenderer(aRenderer); super.setRenderer(aRenderer);
} else {
//throw new IllegalArgumentException("Must be UIComboBoxRenderer");
} }
} }
@ -121,13 +120,15 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
return null; return null;
} }
@Override
public void setGlobalName(String name) { public void setGlobalName(String name) {
comboBoxName = name; comboBoxName = name;
} }
@Override @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);//加5的原因在于:render里,每一个项前面了空了一格,要多几像素 //加5的原因在于:render里,每一个项前面了空了一格,要多几像素
return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);
} }
/** /**
@ -147,15 +148,16 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
/** /**
* *
*/ */
@Override
public void updateUI() { public void updateUI() {
setUI(getUIComboBoxUI()); setUI(getUIComboBoxUI());
} }
/** /**
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerChangeListener(UIObserverListener listener) { public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener; uiObserverListener = listener;
} }
@ -169,46 +171,28 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
} }
/** /**
* @return * @return 是否响应变更事件
*/ */
@Override
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
/** /**
*
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerNameListener(GlobalNameListener listener) { public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener; globalNameListener = listener;
} }
/** /**
* * @return 是否响应名称事件
* @return
*/ */
@Override
public boolean shouldResponseNameListener() { public boolean shouldResponseNameListener() {
return true; return true;
} }
/**
* @param args
*/
public static void main(String... args) {
LayoutManager layoutManager = null;
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(layoutManager);
UIComboBox bb = new UIComboBox(new String[]{"", "jerry", "kunsnat", "richer"});
bb.setEditable(true);
bb.setBounds(20, 20, bb.getPreferredSize().width, bb.getPreferredSize().height);
content.add(bb);
GUICoreUtils.centerWindow(jf);
jf.setSize(400, 400);
jf.setVisible(true);
}
} }

130
designer-realize/src/com/fr/design/dscolumn/DSColumnPane.java

@ -1,26 +1,30 @@
package com.fr.design.dscolumn; package com.fr.design.dscolumn;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.data.TableDataSource; import com.fr.data.TableDataSource;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.frpane.UITabbedPane; import com.fr.design.gui.frpane.UITabbedPane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.dialog.BasicPane;
import com.fr.general.Inter;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.general.Inter;
import com.fr.report.cell.CellElement; import com.fr.report.cell.CellElement;
import com.fr.report.cell.DefaultTemplateCellElement; import com.fr.report.cell.DefaultTemplateCellElement;
import com.fr.report.cell.TemplateCellElement; import com.fr.report.cell.TemplateCellElement;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
/**
* @author null
* @version 2018年2月9日13点47分
* @since 8.0
*/
public class DSColumnPane extends BasicPane { public class DSColumnPane extends BasicPane {
private TableDataSource tplEC; private TableDataSource tplEC;
@ -29,13 +33,52 @@ public class DSColumnPane extends BasicPane {
private DSColumnConditionsPane conditionPane = null; private DSColumnConditionsPane conditionPane = null;
private DSColumnAdvancedPane advancedPane = null; private DSColumnAdvancedPane advancedPane = null;
private TemplateCellElement cellElement; private TemplateCellElement cellElement;
protected Component lastSelectedComponent; private Component lastSelectedComponent;
public static final int SETTING_ALL = 2; public static final int SETTING_ALL = 2;
public static final int SETTING_DSRELATED = 1; public static final int SETTING_DSRELATED = 1;
private ChangeListener appliedWizardTabChangeListener = new ChangeListener() {
@Override
public void stateChanged(ChangeEvent evt) {
try {
if (lastSelectedComponent == null) {
lastSelectedComponent = basicPane;
}
// selectTabComponent是正要切换到的那个Pane
Component selectTabComponent = tabbedPane.getSelectedComponent();
// denny: 如果切换Tab时上一个Pane是basicPane, 则刷新一下其他Pane,
// 因为选择的数据列可能改变, 导致后面过滤和使用公式用到的数据项改变
if (lastSelectedComponent == basicPane) {
basicPane.update(cellElement);
// denny_GUI: 刷新其他面板
refreshOtherTabs();
}
// 切换标签的时候就,确认是否有没有添加到列表中的条件
lastSelectedComponent = selectTabComponent;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
};
/**
* cellElement 改变时刷新一下
* 比如上边切换Tab时basicPane Update了一下可能会改变Field cellElement的值
*/
private PropertyChangeListener myPropertyChangeListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
refreshOtherTabs();
}
};
public DSColumnPane() { public DSColumnPane() {
this.initComponents(SETTING_ALL); this(SETTING_ALL);
} }
public DSColumnPane(int setting) { public DSColumnPane(int setting) {
@ -71,8 +114,12 @@ public class DSColumnPane extends BasicPane {
return Inter.getLocText("ExpandD-Data_Column"); return Inter.getLocText("ExpandD-Data_Column");
} }
/* /**
* populate * 更新面板信息
*
* @param tds 数据源
* @param cellElement 单元格
* @throws Exception e
*/ */
public void populate(TableDataSource tds, TemplateCellElement cellElement) throws Exception { public void populate(TableDataSource tds, TemplateCellElement cellElement) throws Exception {
this.tplEC = tds; this.tplEC = tds;
@ -85,15 +132,18 @@ public class DSColumnPane extends BasicPane {
// _denny: 这边需要克隆一下,因为在设置时,可能改变字段cellElement,但改变真实值是不被期望的 // _denny: 这边需要克隆一下,因为在设置时,可能改变字段cellElement,但改变真实值是不被期望的
try { try {
this.cellElement = (TemplateCellElement) cellElement.clone(); this.cellElement = (TemplateCellElement) cellElement.clone();
} catch (CloneNotSupportedException ce) { } catch (CloneNotSupportedException ignored) {
} }
//REPORT-7744 9.0里面过滤条件和高级设置可以通过其他地方设置,populate的时候需要更新所有面板的信息,防止设置丢失
this.basicPane.populate(tds, this.cellElement); this.basicPane.populate(tds, this.cellElement);
this.conditionPane.populate(tds, this.cellElement); this.conditionPane.populate(tds, this.cellElement);
this.advancedPane.populate(this.cellElement); this.advancedPane.populate(this.cellElement);
} }
/* /**
* update * update 保存
*
* @return 单元格信息
*/ */
public CellElement update() { public CellElement update() {
this.basicPane.update(cellElement); this.basicPane.update(cellElement);
@ -101,49 +151,19 @@ public class DSColumnPane extends BasicPane {
this.advancedPane.update(cellElement); this.advancedPane.update(cellElement);
return cellElement; return cellElement;
} }
public ChangeListener appliedWizardTabChangeListener = new ChangeListener() {
public void stateChanged(ChangeEvent evt) { /**
try { * denny:当数据tab中的数据发生变化的时候刷新后面的tab
if (lastSelectedComponent == null) { */
lastSelectedComponent = basicPane; private void refreshOtherTabs() {
} // deny:当JTabPane中加入一个Pane时,后面的Pane可能还没有初始化
//selectTabComponent是正要切换到的那个Pane
Component selectTabComponent = tabbedPane.getSelectedComponent();
// _denny: 如果切换Tab时上一个Pane是basicPane, 则刷新一下其他Pane,
// 因为选择的数据列可能改变, 导致后面过滤和使用公式用到的数据项改变
if (lastSelectedComponent == basicPane) {
basicPane.update(cellElement);
// denny_GUI: 刷新其他面板
refrushOtherTabs();
}
// 切换标签的时候就,确认是否有没有添加到列表中的条件
lastSelectedComponent = selectTabComponent;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
};
// cellElement 改变时,刷新一下
// 比如:上边切换Tab时,basicPane Update了一下,可能会改变Field cellElement的值
PropertyChangeListener myPropertyChangeListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
refrushOtherTabs();
}
};
//_denny:当数据tab中的数据发生变化的时候刷新后面的tab
public void refrushOtherTabs() {
// ——deny:当JTabPane中加入一个Pane时,后面的Pane可能还没有初始化
if (conditionPane == null || advancedPane == null) { if (conditionPane == null || advancedPane == null) {
return; return;
} }
this.conditionPane.populate(tplEC, cellElement); this.conditionPane.populate(tplEC, cellElement);
this.advancedPane.populate(cellElement); this.advancedPane.populate(cellElement);
} }
public void putElementcase(ElementCasePane t) { public void putElementcase(ElementCasePane t) {
basicPane.putElementcase(t); basicPane.putElementcase(t);
} }

Loading…
Cancel
Save