Browse Source

结果集筛选方式枚举

master
yaoh.wu 7 years ago
parent
commit
1b4a9d82eb
  1. 29
      designer/src/com/fr/design/dscolumn/DSColumnAdvancedPane.java
  2. 112
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

29
designer/src/com/fr/design/dscolumn/DSColumnAdvancedPane.java

@ -5,7 +5,10 @@ import com.fr.data.util.SortOrder;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.*;
import com.fr.design.formula.CustomVariableResolver;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.SortFormulaPane;
import com.fr.design.formula.UIFormula;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.icombobox.UIComboBox;
@ -28,6 +31,8 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.*;
public class DSColumnAdvancedPane extends BasicPane {
private static final String InsetText = " ";
@ -36,7 +41,6 @@ public class DSColumnAdvancedPane extends BasicPane {
private ValuePane valuePane;
private UICheckBox horizontalExtendableCheckBox;
private UICheckBox verticalExtendableCheckBox;
// private UICheckBox isCoverCheckBox;
private UICheckBox useMultiplyNumCheckBox;
private UISpinner multiNumSpinner;
@ -49,15 +53,15 @@ public class DSColumnAdvancedPane extends BasicPane {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
sortPane = new SortPane();
sortPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Sort-Sort_Order"),null));
sortPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Sort-Sort_Order"), null));
if (setting > DSColumnPane.SETTING_DSRELATED) {
selectCountPane = new SelectCountPane();
selectCountPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("BindColumn-Results_Filter"),null));
selectCountPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("BindColumn-Results_Filter"), null));
}
valuePane = new ValuePane();
valuePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("BindColumn-Custom_Data_Appearance"),null));
valuePane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("BindColumn-Custom_Data_Appearance"), null));
JPanel extendablePane = null;
@ -316,7 +320,7 @@ public class DSColumnAdvancedPane extends BasicPane {
}
});
selectCountCardPane =FRGUIPaneFactory.createCardLayout_S_Pane();
selectCountCardPane = FRGUIPaneFactory.createCardLayout_S_Pane();
this.add(GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(InsetText), selectCountComboBox,
new UILabel(InsetText), selectCountCardPane}, FlowLayout.LEFT), BorderLayout.WEST);
// selectCountCardPane.setLayout(new CardLayout());
@ -367,11 +371,11 @@ public class DSColumnAdvancedPane extends BasicPane {
if (selectCount != null) {
int selectCountType = selectCount.getType();
this.selectCountComboBox.setSelectedIndex(selectCountType);
if (selectCountType == SelectCount.TOP) {
if (selectCountType == TOP.getValue()) {
this.topFormulaPane.populate(selectCount.getFormulaCount());
} else if (selectCountType == SelectCount.BOTTOM) {
} else if (selectCountType == BOTTOM.getValue()) {
this.bottomFormulaPane.populate(selectCount.getFormulaCount());
} else if (selectCountType == SelectCount.SPECIFY) {
} else if (selectCountType == SPECIFY.getValue()) {
this.serialTextField.setText(selectCount.getSerial());
}
}
@ -395,11 +399,11 @@ public class DSColumnAdvancedPane extends BasicPane {
SelectCount selectCount = new SelectCount();
dSColumn.setSelectCount(selectCount);
selectCount.setType(selectCountSelectIndex);
if (selectCountSelectIndex == SelectCount.TOP) {
if (selectCountSelectIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText());
} else if (selectCountSelectIndex == SelectCount.BOTTOM) {
} else if (selectCountSelectIndex == BOTTOM.getValue()) {
selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText());
} else if (selectCountSelectIndex == SelectCount.SPECIFY) {
} else if (selectCountSelectIndex == SPECIFY.getValue()) {
selectCount.setSerial(this.serialTextField.getText());
}
}
@ -444,6 +448,7 @@ public class DSColumnAdvancedPane extends BasicPane {
public void populate(String formulaContent) {
this.formulaTextField.setText(formulaContent);
}
public void populateElement(CellElement cellElement) {
this.cellElement = cellElement;
}

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

@ -34,6 +34,7 @@ import com.fr.report.cell.CellElement;
import com.fr.report.cell.TemplateCellElement;
import com.fr.report.cell.cellattr.CellExpandAttr;
import com.fr.report.cell.cellattr.core.group.DSColumn;
import com.fr.report.cell.cellattr.core.group.FilterTypeEnum;
import com.fr.report.cell.cellattr.core.group.SelectCount;
import javax.swing.*;
@ -46,6 +47,9 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import static com.fr.report.cell.cellattr.core.group.FilterTypeEnum.*;
/**
* 单元格元素 数据列编辑器
*
@ -58,10 +62,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
private static final double P = TableLayout.PREFERRED, F = TableLayout.FILL;
private static final Color TIP_FONT_COLOR = new Color(0x7F333334, true);
private enum FilterType {
//前N个 后N个 奇数 偶数 自定义 未定义
TOP, BOTTOM, ODD, EVEN, SPECIFY, UNDEFINE
}
private JPanel dsColumnRegion;
private JPanel centerPane;
@ -674,46 +674,46 @@ public class CellDSColumnEditor extends CellQuickEditor {
int selectIndex = rsComboBox.getSelectedIndex();
CardLayout setCardPaneLayout = (CardLayout) setCardPane.getLayout();
CardLayout tipCardPaneLayout = (CardLayout) tipCardPane.getLayout();
if (selectIndex == SelectCount.TOP) {
if (selectIndex == TOP.getValue()) {
//前N个
setCardPaneLayout.show(setCardPane, FilterType.TOP.name());
tipCardPaneLayout.show(tipCardPane, FilterType.TOP.name());
setCardPaneLayout.show(setCardPane, TOP.name());
tipCardPaneLayout.show(tipCardPane, TOP.name());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} else if (selectIndex == SelectCount.BOTTOM) {
} else if (selectIndex == BOTTOM.getValue()) {
//后N个
setCardPaneLayout.show(setCardPane, FilterType.BOTTOM.name());
tipCardPaneLayout.show(tipCardPane, FilterType.BOTTOM.name());
setCardPaneLayout.show(setCardPane, BOTTOM.name());
tipCardPaneLayout.show(tipCardPane, BOTTOM.name());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
} else if (selectIndex == SelectCount.ODD) {
} else if (selectIndex == ODD.getValue()) {
//奇数
setCardPaneLayout.show(setCardPane, FilterType.ODD.name());
tipCardPaneLayout.show(tipCardPane, FilterType.ODD.name());
setCardPaneLayout.show(setCardPane, ODD.name());
tipCardPaneLayout.show(tipCardPane, ODD.name());
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else if (selectIndex == SelectCount.EVEN) {
} else if (selectIndex == EVEN.getValue()) {
//偶数
setCardPaneLayout.show(setCardPane, FilterType.EVEN.name());
tipCardPaneLayout.show(tipCardPane, FilterType.EVEN.name());
setCardPaneLayout.show(setCardPane, EVEN.name());
tipCardPaneLayout.show(tipCardPane, EVEN.name());
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else if (selectIndex == SelectCount.SPECIFY) {
} else if (selectIndex == SPECIFY.getValue()) {
//指定
setCardPaneLayout.show(setCardPane, FilterType.SPECIFY.name());
tipCardPaneLayout.show(tipCardPane, FilterType.SPECIFY.name());
setCardPaneLayout.show(setCardPane, SPECIFY.name());
tipCardPaneLayout.show(tipCardPane, SPECIFY.name());
//显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
@ -721,8 +721,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
} else {
//未定义
setCardPaneLayout.show(setCardPane, FilterType.UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, FilterType.UNDEFINE.name());
setCardPaneLayout.show(setCardPane, UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, UNDEFINE.name());
//隐藏set和tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
@ -752,36 +752,36 @@ public class CellDSColumnEditor extends CellQuickEditor {
//前N个
topFormulaPane = new JFormulaField(DEFAULT_VALUE);
setCardPane.add(topFormulaPane, FilterType.TOP.name());
tipCardPane.add(new JPanel(), FilterType.TOP.name());
setCardPane.add(topFormulaPane, TOP.name());
tipCardPane.add(new JPanel(), TOP.name());
//后N个
bottomFormulaPane = new JFormulaField(DEFAULT_VALUE);
setCardPane.add(bottomFormulaPane, FilterType.BOTTOM.name());
tipCardPane.add(new JPanel(), FilterType.BOTTOM.name());
setCardPane.add(bottomFormulaPane, BOTTOM.name());
tipCardPane.add(new JPanel(), BOTTOM.name());
//自定义值下方没有提示信息,也没有输入框
setCardPane.add(new JPanel(), FilterType.UNDEFINE.name());
tipCardPane.add(new JPanel(), FilterType.UNDEFINE.name());
setCardPane.add(new JPanel(), UNDEFINE.name());
tipCardPane.add(new JPanel(), UNDEFINE.name());
//奇数 UILabel 占一行作为提示信息
setCardPane.add(new JPanel(), FilterType.ODD.name());
setCardPane.add(new JPanel(), ODD.name());
MultilineLabel oddTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Odd_Tip"));
oddTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(oddTip, FilterType.ODD.name());
tipCardPane.add(oddTip, ODD.name());
//偶数 UILabel 占一行作为提示信息
setCardPane.add(new JPanel(), FilterType.EVEN.name());
setCardPane.add(new JPanel(), EVEN.name());
MultilineLabel evenTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Even_Tip"));
evenTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(evenTip, FilterType.EVEN.name());
tipCardPane.add(evenTip, EVEN.name());
//输入框占用右半边,提示信息占一行
serialTextField = new UITextField(16);
setCardPane.add(serialTextField, FilterType.SPECIFY.name());
setCardPane.add(serialTextField, SPECIFY.name());
MultilineLabel specifyTip = new MultilineLabel(Inter.getLocText("FS-Designer_DS_Filter_Specify_Tip"));
specifyTip.setForeground(TIP_FONT_COLOR);
tipCardPane.add(specifyTip, FilterType.SPECIFY.name());
tipCardPane.add(specifyTip, SPECIFY.name());
contentPane = TableLayoutHelper.createDiffVGapTableLayoutPane(new Component[][]{
{filterLabel, rsComboBox},
{null, setCardPane},
@ -805,54 +805,54 @@ public class CellDSColumnEditor extends CellQuickEditor {
if (selectCount != null) {
int selectCountType = selectCount.getType();
this.rsComboBox.setSelectedIndex(selectCountType);
switch (selectCountType) {
case SelectCount.TOP:
switch (FilterTypeEnum.getFilterByValue(selectCountType)) {
case TOP:
this.topFormulaPane.populate(selectCount.getFormulaCount());
//前N个
setCardPaneLayout.show(setCardPane, FilterType.TOP.name());
tipCardPaneLayout.show(tipCardPane, FilterType.TOP.name());
setCardPaneLayout.show(setCardPane, TOP.name());
tipCardPaneLayout.show(tipCardPane, TOP.name());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
break;
case SelectCount.BOTTOM:
case BOTTOM:
this.bottomFormulaPane.populate(selectCount.getFormulaCount());
//后N个
setCardPaneLayout.show(setCardPane, FilterType.BOTTOM.name());
tipCardPaneLayout.show(tipCardPane, FilterType.BOTTOM.name());
setCardPaneLayout.show(setCardPane, BOTTOM.name());
tipCardPaneLayout.show(tipCardPane, BOTTOM.name());
//隐藏tip 显示set
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, 0);
break;
case SelectCount.SPECIFY:
case SPECIFY:
this.serialTextField.setText(selectCount.getSerial());
//指定
setCardPaneLayout.show(setCardPane, FilterType.SPECIFY.name());
tipCardPaneLayout.show(tipCardPane, FilterType.SPECIFY.name());
setCardPaneLayout.show(setCardPane, SPECIFY.name());
tipCardPaneLayout.show(tipCardPane, SPECIFY.name());
//显示set和tip
setCardPane.setPreferredSize(new Dimension(156, 20));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, VGAP);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
break;
case SelectCount.EVEN:
case EVEN:
//偶数
setCardPaneLayout.show(setCardPane, FilterType.EVEN.name());
tipCardPaneLayout.show(tipCardPane, FilterType.EVEN.name());
setCardPaneLayout.show(setCardPane, EVEN.name());
tipCardPaneLayout.show(tipCardPane, EVEN.name());
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
tipCardPane.setPreferredSize(new Dimension(224, 40));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 4, VGAP_INNER);
break;
case SelectCount.ODD:
case ODD:
//奇数
setCardPaneLayout.show(setCardPane, FilterType.ODD.name());
tipCardPaneLayout.show(tipCardPane, FilterType.ODD.name());
setCardPaneLayout.show(setCardPane, ODD.name());
tipCardPaneLayout.show(tipCardPane, ODD.name());
//隐藏set 显示tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
@ -861,8 +861,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
break;
default:
//未定义
setCardPaneLayout.show(setCardPane, FilterType.UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, FilterType.UNDEFINE.name());
setCardPaneLayout.show(setCardPane, UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, UNDEFINE.name());
//隐藏set和tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
@ -871,8 +871,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
} else {
//未定义
setCardPaneLayout.show(setCardPane, FilterType.UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, FilterType.UNDEFINE.name());
setCardPaneLayout.show(setCardPane, UNDEFINE.name());
tipCardPaneLayout.show(tipCardPane, UNDEFINE.name());
//隐藏set和tip
setCardPane.setPreferredSize(new Dimension(0, 0));
TableLayoutHelper.modifyTableLayoutIndexVGap(contentPane, 2, 0);
@ -896,11 +896,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
SelectCount selectCount = new SelectCount();
selectCount.setType(selectedFilterIndex);
dSColumn.setSelectCount(selectCount);
if (selectedFilterIndex == SelectCount.TOP) {
if (selectedFilterIndex == TOP.getValue()) {
selectCount.setFormulaCount(this.topFormulaPane.getFormulaText());
} else if (selectedFilterIndex == SelectCount.BOTTOM) {
} else if (selectedFilterIndex == BOTTOM.getValue()) {
selectCount.setFormulaCount(this.bottomFormulaPane.getFormulaText());
} else if (selectedFilterIndex == SelectCount.SPECIFY) {
} else if (selectedFilterIndex == SPECIFY.getValue()) {
selectCount.setSerial(this.serialTextField.getText());
}
}

Loading…
Cancel
Save