From 5c7c5acef3a2d60d3c567e900c484c9cc075bf4f Mon Sep 17 00:00:00 2001 From: "yaoh.wu" Date: Tue, 29 May 2018 18:55:24 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-6868=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=97=E5=8D=95=E5=85=83=E6=A0=BC=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E9=A2=91=E7=B9=81=E5=BC=B9=E5=87=BAsql=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E5=AF=B9=E8=AF=9D=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/gui/demo/ComboBoxDemo.java | 48 +-- .../design/gui/demo/SwingComponentsDemo.java | 17 +- .../fr/design/gui/icombobox/LazyComboBox.java | 338 ++++++++---------- .../fr/design/gui/icombobox/UIComboBox.java | 70 ++-- .../com/fr/design/dscolumn/DSColumnPane.java | 156 ++++---- 5 files changed, 307 insertions(+), 322 deletions(-) diff --git a/designer-base/src/com/fr/design/gui/demo/ComboBoxDemo.java b/designer-base/src/com/fr/design/gui/demo/ComboBoxDemo.java index a47ea5b0ce..a29d78dd0f 100644 --- a/designer-base/src/com/fr/design/gui/demo/ComboBoxDemo.java +++ b/designer-base/src/com/fr/design/gui/demo/ComboBoxDemo.java @@ -1,34 +1,37 @@ 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.design.gui.icombobox.filter.Filter; +import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.gui.icombobox.ComboCheckBox; import com.fr.design.gui.icombobox.DictionaryComboBox; import com.fr.design.gui.icombobox.ExtendedComboBox; import com.fr.design.gui.icombobox.FRTreeComboBox; import com.fr.design.gui.icombobox.FilterComboBox; 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.TableLayout; 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.stable.ParameterProvider; 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. * User: Richer @@ -42,12 +45,12 @@ public class ComboBoxDemo extends JPanel { double f = TableLayout.FILL; Component[][] coms = new Component[][]{ - {new UILabel(Inter.getLocText("Form-ComboCheckBox")+":"), createComboCheckBox()}, - {new UILabel(Inter.getLocText(new String[]{"DS-Dictionary", "Form-ComboBox"})+":"), createDictComboBox()}, - {new UILabel(Inter.getLocText("long_data_can_not_show_fully")+":"), createExtendedComboBox()}, - {new UILabel(Inter.getLocText(new String[]{"Filter", "Form-ComboBox"})+":"), createFilterComboBox()}, - {new UILabel(Inter.getLocText("Form-ComboBox")+":"), createTreeComboBox()}, - {new UILabel(Inter.getLocText(new String[]{"Delay", "Load", "Form-ComboBox"})+":"), createLazyComboBox()} + {new UILabel(Inter.getLocText("Form-ComboCheckBox") + ":"), createComboCheckBox()}, + {new UILabel(Inter.getLocText(new String[]{"DS-Dictionary", "Form-ComboBox"}) + ":"), createDictComboBox()}, + {new UILabel(Inter.getLocText("long_data_can_not_show_fully") + ":"), createExtendedComboBox()}, + {new UILabel(Inter.getLocText(new String[]{"Filter", "Form-ComboBox"}) + ":"), createFilterComboBox()}, + {new UILabel(Inter.getLocText("Form-ComboBox") + ":"), createTreeComboBox()}, + {new UILabel(Inter.getLocText(new String[]{"Delay", "Load", "Form-ComboBox"}) + ":"), createLazyComboBox()} }; double[] rowSize = new double[coms.length]; double[] columnSize = {p, f}; @@ -165,6 +168,7 @@ public class ComboBoxDemo extends JPanel { // 睡5秒 try { Thread.sleep(5000); + } catch (InterruptedException e) { FRContext.getLogger().error(e.getMessage(), e); } diff --git a/designer-base/src/com/fr/design/gui/demo/SwingComponentsDemo.java b/designer-base/src/com/fr/design/gui/demo/SwingComponentsDemo.java index 6a08e38b06..a3771ce235 100644 --- a/designer-base/src/com/fr/design/gui/demo/SwingComponentsDemo.java +++ b/designer-base/src/com/fr/design/gui/demo/SwingComponentsDemo.java @@ -1,16 +1,15 @@ 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.JPanel; import javax.swing.JTabbedPane; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; - -import com.fr.design.layout.FRGUIPaneFactory; -import com.fr.design.utils.DesignUtils; -import com.fr.design.utils.gui.GUICoreUtils; +import java.awt.BorderLayout; /** * Created by IntelliJ IDEA. @@ -19,10 +18,10 @@ import com.fr.design.utils.gui.GUICoreUtils; * Time: 下午4:54 */ public class SwingComponentsDemo extends JFrame { - public SwingComponentsDemo() { - this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + private SwingComponentsDemo() { + this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); init(); - JPanel contentPane = (JPanel)getContentPane(); + JPanel contentPane = (JPanel) getContentPane(); contentPane.setLayout(FRGUIPaneFactory.createBorderLayout()); JTabbedPane tab = new JTabbedPane(); contentPane.add(tab, BorderLayout.CENTER); @@ -40,12 +39,12 @@ public class SwingComponentsDemo extends JFrame { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { JFrame f = new SwingComponentsDemo(); f.setSize(500, 500); f.setVisible(true); GUICoreUtils.centerWindow(f); - f.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); } }); } diff --git a/designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java b/designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java index fa4464cfc3..2ec5590f64 100644 --- a/designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java +++ b/designer-base/src/com/fr/design/gui/icombobox/LazyComboBox.java @@ -3,212 +3,190 @@ */ package com.fr.design.gui.icombobox; -import java.awt.Dimension; -import java.util.ArrayList; -import java.util.List; +import com.fr.general.FRLogger; +import com.fr.general.Inter; -import javax.swing.*; +import javax.swing.DefaultComboBoxModel; +import javax.swing.SwingWorker; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; -import javax.swing.plaf.basic.BasicComboPopup; - -import com.fr.general.Inter; +import java.awt.Dimension; +import java.util.concurrent.ExecutionException; /** * @author richer + * @version 2018年2月6日14点43分 by @yaoh.wu * @since 6.5.5 创建于2011-6-15 延迟加载的下拉框 */ public abstract class LazyComboBox extends UIComboBox implements PopupMenuListener { - protected boolean loaded = false; - private List ls = new ArrayList(); - private Object initialSelected = null; - private static final int NUM=80; - - public static final Object PENDING = new Object() { - - @Override - public String toString() { - return Inter.getLocText("Loading") + "..."; - } - }; - - public LazyComboBox() { - super(); - this.setEditor(new FilterComboBoxEditor()); - addPopupMenuListener(this); -// updateUI(); - } - - public void setLoaded(boolean loaded) { - this.loaded = loaded; - } - - public abstract Object[] load(); - - public void setSelectedItem(Object anObject) { - initialSelected = anObject; - if (loaded) { - super.setSelectedItem(anObject); - } else { - - setModel(new DefaultComboBoxModel(new Object[] { anObject })); - super.setSelectedItem(anObject); - } - } - - /** - * 通过调用该方法,在点击下拉框按钮之前就加载好数据 - */ - public void loadInstant() { - if (loaded) { - return; - } - setModel(new DefaultComboBoxModel(load())); - loaded = true; - } - - @Override - public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + + private static final int NUM = 80; + private static final String[] PENDING_CONTENT = new String[]{"", Inter.getLocText("Loading") + "..."}; + + /** + * 是否加载完成 + */ + protected boolean loaded = false; + + /** + * 初始化选项 + */ + private Object initialSelected = null; + + + protected LazyComboBox() { + super(); + this.setEditor(new FilterComboBoxEditor()); + addPopupMenuListener(this); + } + + public void setLoaded(boolean loaded) { + this.loaded = loaded; + } + + /** + * 加载下拉框中的选项 + * + * @return 下拉框中的选项 + */ + public abstract Object[] load(); + + @Override + public void setSelectedItem(Object anObject) { + initialSelected = anObject; + if (loaded) { + super.setSelectedItem(anObject); + } else { + this.setModel(new DefaultComboBoxModel<>(new Object[]{anObject})); + super.setSelectedItem(anObject); + } + } + + @Override + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { if (loaded) { return; } - DefaultComboBoxModel loadingModel = new DefaultComboBoxModel(new String[]{"", Inter.getLocText("Loading") + "..."}); - LazyComboBox.this.setModel(loadingModel); - new SwingWorker() { + DefaultComboBoxModel loadingModel = new DefaultComboBoxModel<>(PENDING_CONTENT); + this.setModel(loadingModel); + new SwingWorker() { @Override - protected Void doInBackground() throws Exception { - final Object selectedObj = getSelectedItem(); - loadList(); - return null; + protected Object[] doInBackground() { + return load(); } @Override public void done() { - LazyComboBox.this.updateUI(); - LazyComboBox.this.fireEvent(); + try { + LazyComboBox.this.loadList(get()); + } catch (InterruptedException | ExecutionException exception) { + FRLogger.getLogger().debug(exception.getMessage()); + } LazyComboBox.this.showPopup(); } - }.execute(); + } + /** + * 加载下拉列表 + */ + public void loadList() { + DefaultComboBoxModel model = new DefaultComboBoxModel<>(load()); + model.setSelectedItem(initialSelected); + this.setModel(model); + this.selectedItemReminder = initialSelected; + loaded = true; } - /** - * 计算加载下拉列表 - */ - public void loadList() { - DefaultComboBoxModel model = new DefaultComboBoxModel(load()); + /** + * 加载下拉列表 + * + * @param contents 下拉列表内容 + */ + private void loadList(Object[] contents) { + DefaultComboBoxModel model = new DefaultComboBoxModel<>(contents); model.setSelectedItem(initialSelected); - LazyComboBox.this.setModel(model); - LazyComboBox.this.selectedItemReminder = initialSelected ; - loaded = true; - } - - @Override - public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { - - } - - @Override - public void popupMenuCanceled(PopupMenuEvent e) { - - } - - public void addClickListener(EventListener l) { - if (ls == null) { - ls = new ArrayList(); - } - ls.add(l); - } - - public void fireEvent() { - for (int i = 0, n = ls.size(); i < n; i++) { - ls.get(i).fireEvent(); - } - } - - @Override - public Dimension getPreferredSize() { - Dimension dim = super.getPreferredSize(); - dim.width = NUM; - 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 { - private Object item; - private volatile boolean filtering = false; - private volatile boolean setting = false; - - public FilterComboBoxEditor() { - super(); - textField.getDocument().addDocumentListener(this); - } - - public void setItem(Object item) { - if (filtering) { - return; - } - this.item = item; - - this.setting = true; - textField.setSetting(true); - String newText = (item == null) ? "" : item.toString(); - textField.setText(newText); - textField.setSetting(false); - this.setting = false; - } - - public Object getItem() { - return this.item; - } - - public void insertUpdate(DocumentEvent e) { - handleChange(); - } - - public void removeUpdate(DocumentEvent e) { - handleChange(); - } - - public void changedUpdate(DocumentEvent e) { - handleChange(); - } - - protected void handleChange() { - if (setting) { - return; - } - filtering = true; - String xx = textField.getText(); - LazyComboBox.this.setSelectedItem(xx); - this.item = textField.getText(); - - setPopupVisible(true); - filtering = false; - } - } + this.setModel(model); + this.selectedItemReminder = initialSelected; + loaded = true; + } + + @Override + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + + } + + @Override + public void popupMenuCanceled(PopupMenuEvent e) { + + } + + @Override + public Dimension getPreferredSize() { + Dimension dim = super.getPreferredSize(); + dim.width = NUM; + return dim; + } + + class FilterComboBoxEditor extends UIComboBoxEditor implements DocumentListener { + private Object item; + private volatile boolean filtering = false; + private volatile boolean setting = false; + + public FilterComboBoxEditor() { + super(); + textField.getDocument().addDocumentListener(this); + } + + @Override + public void setItem(Object item) { + if (filtering) { + return; + } + this.item = item; + this.setting = true; + textField.setSetting(true); + String newText = (item == null) ? "" : item.toString(); + textField.setText(newText); + textField.setSetting(false); + this.setting = false; + } + + @Override + public Object getItem() { + return this.item; + } + + @Override + public void insertUpdate(DocumentEvent e) { + handleChange(); + } + + @Override + public void removeUpdate(DocumentEvent e) { + handleChange(); + } + + @Override + public void changedUpdate(DocumentEvent e) { + handleChange(); + } + + void handleChange() { + if (setting) { + return; + } + filtering = true; + String xx = textField.getText(); + LazyComboBox.this.setSelectedItem(xx); + this.item = textField.getText(); + + setPopupVisible(true); + filtering = false; + } + } } \ No newline at end of file diff --git a/designer-base/src/com/fr/design/gui/icombobox/UIComboBox.java b/designer-base/src/com/fr/design/gui/icombobox/UIComboBox.java index f9ce6b78fb..14a90da7b2 100644 --- a/designer-base/src/com/fr/design/gui/icombobox/UIComboBox.java +++ b/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.UIObserver; 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.basic.ComboPopup; -import java.awt.*; +import java.awt.Dimension; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.awt.event.ItemEvent; @@ -112,8 +113,6 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser public void setRenderer(ListCellRenderer aRenderer) { if (aRenderer instanceof UIComboBoxRenderer) { super.setRenderer(aRenderer); - } else { - //throw new IllegalArgumentException("Must be UIComboBoxRenderer"); } } @@ -121,13 +120,15 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser return null; } + @Override public void setGlobalName(String name) { comboBoxName = name; } @Override public Dimension getPreferredSize() { - return new Dimension(super.getPreferredSize().width + SIZE5, SIZE);//加5的原因在于:render里,每一个项前面了空了一格,要多几像素 + //加5的原因在于:render里,每一个项前面了空了一格,要多几像素 + return new Dimension(super.getPreferredSize().width + SIZE5, SIZE); } /** @@ -144,70 +145,53 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser } - /** - * - */ + /** + * + */ + @Override public void updateUI() { setUI(getUIComboBoxUI()); } - /** - * - * @param listener 观察者监听事件 - */ + /** + * @param listener 观察者监听事件 + */ + @Override public void registerChangeListener(UIObserverListener listener) { uiObserverListener = listener; } - public void removeChangeListener(){ + public void removeChangeListener() { uiObserverListener = null; } - public UIObserverListener getUiObserverListener(){ + public UIObserverListener getUiObserverListener() { return uiObserverListener; } /** - * @return + * @return 是否响应变更事件 */ + @Override public boolean shouldResponseChangeListener() { return true; } - /** - * - * @param listener 观察者监听事件 - */ + /** + * @param listener 观察者监听事件 + */ + @Override public void registerNameListener(GlobalNameListener listener) { globalNameListener = listener; } - /** - * - * @return - */ - public boolean shouldResponseNameListener() { - return true; - } - - /** - * @param args + * @return 是否响应名称事件 */ - 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); + @Override + public boolean shouldResponseNameListener() { + return true; } diff --git a/designer-realize/src/com/fr/design/dscolumn/DSColumnPane.java b/designer-realize/src/com/fr/design/dscolumn/DSColumnPane.java index 2e5d251896..af48fb8539 100644 --- a/designer-realize/src/com/fr/design/dscolumn/DSColumnPane.java +++ b/designer-realize/src/com/fr/design/dscolumn/DSColumnPane.java @@ -1,26 +1,30 @@ 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.data.TableDataSource; +import com.fr.design.dialog.BasicPane; import com.fr.design.gui.frpane.UITabbedPane; 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.general.Inter; import com.fr.report.cell.CellElement; import com.fr.report.cell.DefaultTemplateCellElement; 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 { private TableDataSource tplEC; @@ -29,17 +33,56 @@ public class DSColumnPane extends BasicPane { private DSColumnConditionsPane conditionPane = null; private DSColumnAdvancedPane advancedPane = null; private TemplateCellElement cellElement; - protected Component lastSelectedComponent; - + private Component lastSelectedComponent; + public static final int SETTING_ALL = 2; 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() { - this.initComponents(SETTING_ALL); + this(SETTING_ALL); } - + public DSColumnPane(int setting) { - this.initComponents(setting); + this.initComponents(setting); } protected void initComponents(int setting) { @@ -65,18 +108,22 @@ public class DSColumnPane extends BasicPane { this.setPreferredSize(new Dimension(610, 400)); } - + @Override protected String title4PopupWindow() { - 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 { - this.tplEC = tds; - + this.tplEC = tds; + if (tds == null || cellElement == null) { // _denny: 我不认为这种情况应该出现,以防万一 this.cellElement = new DefaultTemplateCellElement(); @@ -85,15 +132,18 @@ public class DSColumnPane extends BasicPane { // _denny: 这边需要克隆一下,因为在设置时,可能改变字段cellElement,但改变真实值是不被期望的 try { this.cellElement = (TemplateCellElement) cellElement.clone(); - } catch (CloneNotSupportedException ce) { + } catch (CloneNotSupportedException ignored) { } + //REPORT-7744 9.0里面过滤条件和高级设置可以通过其他地方设置,populate的时候需要更新所有面板的信息,防止设置丢失 this.basicPane.populate(tds, this.cellElement); this.conditionPane.populate(tds, this.cellElement); this.advancedPane.populate(this.cellElement); } - /* - * update + /** + * update 保存 + * + * @return 单元格信息 */ public CellElement update() { this.basicPane.update(cellElement); @@ -101,54 +151,24 @@ public class DSColumnPane extends BasicPane { this.advancedPane.update(cellElement); return cellElement; } - public ChangeListener appliedWizardTabChangeListener = new ChangeListener() { - - 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: 刷新其他面板 - 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可能还没有初始化 + /** + * denny:当数据tab中的数据发生变化的时候刷新后面的tab + */ + private void refreshOtherTabs() { + // deny:当JTabPane中加入一个Pane时,后面的Pane可能还没有初始化 if (conditionPane == null || advancedPane == null) { return; } this.conditionPane.populate(tplEC, cellElement); this.advancedPane.populate(cellElement); } - public void putElementcase(ElementCasePane t){ - basicPane.putElementcase(t); + + public void putElementcase(ElementCasePane t) { + basicPane.putElementcase(t); } - public void putCellElement(TemplateCellElement tplCE) { - basicPane.putCellElement(tplCE); - } + public void putCellElement(TemplateCellElement tplCE) { + basicPane.putCellElement(tplCE); + } } \ No newline at end of file