Browse Source

REPORT-3348 结果集筛选 公式输入框触发保存

master
yaoh.wu 8 years ago
parent
commit
8ccc9e0696
  1. 71
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  2. 70
      designer_base/src/com/fr/design/selection/QuickEditor.java

71
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -398,27 +398,35 @@ public class CellDSColumnEditor extends CellQuickEditor {
//结果集排序 //结果集排序
sortPane = new ResultSetSortConfigPane(); sortPane = new ResultSetSortConfigPane();
sortPane.addListener(new UIObserverListener() { sortPane.addListener(new UIObserverListener() {
@Override @Override
public void doChange() { public void doChange() {
sortPane.update(cellElement); sortPane.update(cellElement);
fireTargetModified(); fireTargetModified();
} }
}, new ChangeListener() { }, new ChangeListener() {
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
sortPane.update(cellElement); sortPane.update(cellElement);
fireTargetModified(); fireTargetModified();
} }
}); }
);
//结果筛选 //结果筛选
filterPane = new ResultSetFilterConfigPane(); filterPane = new ResultSetFilterConfigPane();
filterPane.addListener(new ActionListener() { filterPane.addListener(new UIObserverListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void doChange() {
filterPane.update(cellElement); filterPane.update(cellElement);
fireTargetModified(); fireTargetModified();
} }
}); }, new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
filterPane.update(cellElement);
fireTargetModified();
}
}
);
//自定义值显示 //自定义值显示
valuePane = new CustomValuePane(); valuePane = new CustomValuePane();
//可扩展性 //可扩展性
@ -564,6 +572,12 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
} }
/**
* 添加事件监听器
*
* @param formulaChangeListener 公式输入框改动事件监听器
* @param changeListener 排序类型下拉框改动事件监听器
*/
public void addListener(UIObserverListener formulaChangeListener, ChangeListener changeListener) { public void addListener(UIObserverListener formulaChangeListener, ChangeListener changeListener) {
tinyFormulaPane.registerChangeListener(formulaChangeListener); tinyFormulaPane.registerChangeListener(formulaChangeListener);
sortTypePane.addChangeListener(changeListener); sortTypePane.addChangeListener(changeListener);
@ -729,7 +743,15 @@ public class CellDSColumnEditor extends CellQuickEditor {
} }
} }
public void addListener(ActionListener actionListener) { /**
* 添加事件监听器
*
* @param formulaListener 公式输入框改动事件监听器
* @param actionListener 筛选类型下拉框改动事件监听器
*/
public void addListener(UIObserverListener formulaListener, ActionListener actionListener) {
topFormulaPane.addListener(formulaListener);
bottomFormulaPane.addListener(formulaListener);
rsComboBox.addActionListener(actionListener); rsComboBox.addActionListener(actionListener);
} }
} }
@ -781,6 +803,15 @@ public class CellDSColumnEditor extends CellQuickEditor {
return this.formulaTextField.getText(); return this.formulaTextField.getText();
} }
/**
* 添加事件监听器
*
* @param listener 公式文本输入框改动事件监听器
*/
public void addListener(UIObserverListener listener) {
this.formulaTextField.registerChangeListener(listener);
}
private ActionListener formulaButtonActionListener = new ActionListener() { private ActionListener formulaButtonActionListener = new ActionListener() {
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
Formula valueFormula = new Formula(); Formula valueFormula = new Formula();

70
designer_base/src/com/fr/design/selection/QuickEditor.java

@ -1,61 +1,61 @@
package com.fr.design.selection; package com.fr.design.selection;
import javax.swing.JComponent;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import javax.swing.*;
/** /**
* 快速编辑区域 * 快速编辑区域
* *
* @author zhou * @author zhou
* @since 2012-7-12下午2:48:20 * @since 2012-7-12下午2:48:20
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public abstract class QuickEditor<T extends TargetComponent> extends JComponent { public abstract class QuickEditor<T extends TargetComponent> extends JComponent {
private static final long serialVersionUID = 5434472104640676832L; private static final long serialVersionUID = 5434472104640676832L;
protected T tc; protected T tc;
protected boolean isEditing = false; protected boolean isEditing = false;
public QuickEditor() { public QuickEditor() {
} }
public void populate(T tc) { public void populate(T tc) {
isEditing = false; isEditing = false;
this.tc = tc; this.tc = tc;
refresh(); refresh();
isEditing = true; isEditing = true;
} }
/** /**
* 触发保存一定要用这个 * 触发保存一定要用这个
*/ */
protected void fireTargetModified() { protected void fireTargetModified() {
if(!isEditing) { if (!isEditing) {
return; return;
} }
tc.fireTargetModified(); tc.fireTargetModified();
} }
protected abstract void refresh(); protected abstract void refresh();
/** /**
* for 关闭时候释放 * for 关闭时候释放
*/ */
public void release () { public void release() {
tc = null; tc = null;
} }
public static QuickEditor DEFAULT_EDITOR = new QuickEditor() { public static QuickEditor DEFAULT_EDITOR = new QuickEditor() {
@Override @Override
protected void refresh() { protected void refresh() {
} }
}; };
} }
Loading…
Cancel
Save