|
|
|
@ -40,32 +40,32 @@ import java.util.ArrayList;
|
|
|
|
|
* SpecifiedGroupAttrDialog |
|
|
|
|
*/ |
|
|
|
|
public class SpecifiedGroupAttrPane extends BasicPane { |
|
|
|
|
private CardLayout cardLayout; |
|
|
|
|
private JPanel centerCardPane; |
|
|
|
|
private JPanel conditionsGroupPane; |
|
|
|
|
private FormulaGroupPane formulaGroupPane; |
|
|
|
|
private CardLayout cardLayout; |
|
|
|
|
private JPanel centerCardPane; |
|
|
|
|
private JPanel conditionsGroupPane; |
|
|
|
|
private FormulaGroupPane formulaGroupPane; |
|
|
|
|
|
|
|
|
|
private UIComboBox specifiedComboBox; |
|
|
|
|
private SpecifiedGroupControlPane specifiedControlPane; |
|
|
|
|
private UIComboBox specifiedComboBox; |
|
|
|
|
private SpecifiedGroupControlPane specifiedControlPane; |
|
|
|
|
|
|
|
|
|
//下拉选择列名需要的
|
|
|
|
|
private String[] displayNames; |
|
|
|
|
private String[] displayNames; |
|
|
|
|
|
|
|
|
|
//other pane的控件
|
|
|
|
|
private UICheckBox forceCheckBox; |
|
|
|
|
private UICheckBox moreCheckBox; |
|
|
|
|
private UIComboBox otherComboBox; |
|
|
|
|
private UITextField otherTextField; |
|
|
|
|
|
|
|
|
|
private UITextField otherTextField; |
|
|
|
|
|
|
|
|
|
public class SpecifiedGroupControlPane extends ObjectJControlPane { |
|
|
|
|
public SpecifiedGroupControlPane(String[] displayNames) { |
|
|
|
|
super(displayNames); |
|
|
|
|
this.addModNameActionListener(new ModNameActionListener() { |
|
|
|
|
public void nameModed(int index, String oldName, String newName) { |
|
|
|
|
populateSelectedValue(); |
|
|
|
|
} |
|
|
|
|
public SpecifiedGroupControlPane(String[] displayNames) { |
|
|
|
|
super(displayNames); |
|
|
|
|
this.addModNameActionListener(new ModNameActionListener() { |
|
|
|
|
public void nameModed(int index, String oldName, String newName) { |
|
|
|
|
populateSelectedValue(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public NameableCreator[] createNameableCreators() { |
|
|
|
@ -81,46 +81,46 @@ public class SpecifiedGroupAttrPane extends BasicPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public SpecifiedGroupAttrPane(String[] displayNames) { |
|
|
|
|
this.displayNames = displayNames; |
|
|
|
|
this.displayNames = displayNames; |
|
|
|
|
this.initComponents(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected void initComponents() { |
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
specifiedComboBox = new UIComboBox(new String[]{ |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Condition_Group"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Formula_Group") |
|
|
|
|
specifiedComboBox = new UIComboBox(new String[] { |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"Condition", "Group"}), com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"Formula", "Group"}) |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
specifiedComboBox.addItemListener(new ItemListener() { |
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
if (specifiedComboBox.getSelectedIndex() == 0) { |
|
|
|
|
cardLayout.show(centerCardPane, "Condition"); |
|
|
|
|
} else { |
|
|
|
|
cardLayout.show(centerCardPane, "Formula"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
public void itemStateChanged(ItemEvent e) { |
|
|
|
|
if (specifiedComboBox.getSelectedIndex() == 0) { |
|
|
|
|
cardLayout.show(centerCardPane, "Condition"); |
|
|
|
|
} else { |
|
|
|
|
cardLayout.show(centerCardPane, "Formula"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel northPane = GUICoreUtils.createFlowPane( |
|
|
|
|
new JComponent[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Select_Specified_Grouping") + ":"), |
|
|
|
|
specifiedComboBox}, FlowLayout.LEFT); |
|
|
|
|
this.add(northPane, BorderLayout.NORTH); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cardLayout = new CardLayout(); |
|
|
|
|
centerCardPane = FRGUIPaneFactory.createCardLayout_S_Pane(); |
|
|
|
|
centerCardPane.setLayout(cardLayout); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 条件分组
|
|
|
|
|
conditionsGroupPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
|
|
|
|
specifiedControlPane = new SpecifiedGroupControlPane(displayNames); |
|
|
|
|
|
|
|
|
|
conditionsGroupPane.add(specifiedControlPane, BorderLayout.CENTER); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JPanel southPane = FRGUIPaneFactory.createMediumHGapFlowInnerContainer_M_Pane(); |
|
|
|
|
conditionsGroupPane.add(southPane, BorderLayout.SOUTH); |
|
|
|
|
forceCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_SpecifiedG-Force_Group")); |
|
|
|
|
moreCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_One_Record_Exists_In_Many_Groups")); |
|
|
|
|
southPane.add(forceCheckBox); southPane.add(moreCheckBox); |
|
|
|
|
southPane.add(forceCheckBox); southPane.add(moreCheckBox); |
|
|
|
|
otherComboBox = new UIComboBox(new String[] {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_SpecifiedG-Discard_All_Others"), |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_SpecifiedG_Leave_In_Their_Own_Groups"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_SpecifiedG_Put_All_Others_Together")}); |
|
|
|
|
otherComboBox.addItemListener(otherItemListener); |
|
|
|
@ -128,16 +128,16 @@ public class SpecifiedGroupAttrPane extends BasicPane {
|
|
|
|
|
otherTextField = new UITextField(8); |
|
|
|
|
southPane.add(otherComboBox); |
|
|
|
|
southPane.add(GUICoreUtils.createFlowPane(new Component[]{label, otherTextField}, FlowLayout.LEFT)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 公式分组
|
|
|
|
|
formulaGroupPane = new FormulaGroupPane(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
centerCardPane.add("Condition", conditionsGroupPane); |
|
|
|
|
centerCardPane.add("Formula", formulaGroupPane); |
|
|
|
|
this.add(centerCardPane, BorderLayout.CENTER); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected String title4PopupWindow() { |
|
|
|
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_SpecifiedG_Specified_Group"); |
|
|
|
@ -160,61 +160,61 @@ public class SpecifiedGroupAttrPane extends BasicPane {
|
|
|
|
|
* check Valid |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public void checkValid() throws Exception { |
|
|
|
|
|
|
|
|
|
public void checkValid() throws Exception { |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// denny_DS
|
|
|
|
|
// denny_DS
|
|
|
|
|
public void populate(RecordGrouper grouper) { |
|
|
|
|
if (grouper == null) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(grouper == null){ |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (grouper instanceof CustomGrouper) { |
|
|
|
|
this.specifiedComboBox.setSelectedIndex(0); |
|
|
|
|
cardLayout.show(centerCardPane, "Condition"); |
|
|
|
|
CustomGrouper customGrouper = (CustomGrouper) grouper; |
|
|
|
|
boolean force = customGrouper.isForce(); |
|
|
|
|
ConditionGroup[] conditionGroups = customGrouper.getConditionGroups(); |
|
|
|
|
boolean more = customGrouper.isMore(); |
|
|
|
|
int other = customGrouper.getOther(); |
|
|
|
|
String odisplay = customGrouper.getOtherdisplay(); |
|
|
|
|
|
|
|
|
|
this.forceCheckBox.setSelected(force); |
|
|
|
|
|
|
|
|
|
this.moreCheckBox.setSelected(more); |
|
|
|
|
|
|
|
|
|
if (other == CustomGrouper.TOGETHER) { |
|
|
|
|
this.otherComboBox.setSelectedIndex(2); |
|
|
|
|
this.otherTextField.setEnabled(true); |
|
|
|
|
} else if (other == CustomGrouper.DISCARD) { |
|
|
|
|
this.otherComboBox.setSelectedIndex(0); |
|
|
|
|
this.otherTextField.setEnabled(false); |
|
|
|
|
} else { |
|
|
|
|
this.otherComboBox.setSelectedIndex(1); |
|
|
|
|
this.otherTextField.setEnabled(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (odisplay != null) { |
|
|
|
|
this.otherTextField.setText(odisplay); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (conditionGroups != null) { |
|
|
|
|
java.util.List<NameObject> list = new ArrayList<NameObject>(); |
|
|
|
|
for (int i = 0; i < conditionGroups.length; i++) { |
|
|
|
|
list.add(new NameObject(conditionGroups[i].getDisplay(), conditionGroups[i])); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
specifiedControlPane.populate(list.toArray(new NameObject[list.size()])); |
|
|
|
|
} |
|
|
|
|
} else if (grouper instanceof FunctionGrouper |
|
|
|
|
&& ((FunctionGrouper) grouper).isCustom()) { |
|
|
|
|
this.specifiedComboBox.setSelectedIndex(1); |
|
|
|
|
cardLayout.show(centerCardPane, "Formula"); |
|
|
|
|
formulaGroupPane.populate(grouper); |
|
|
|
|
this.specifiedComboBox.setSelectedIndex(0); |
|
|
|
|
cardLayout.show(centerCardPane, "Condition"); |
|
|
|
|
CustomGrouper customGrouper = (CustomGrouper)grouper; |
|
|
|
|
boolean force = customGrouper.isForce(); |
|
|
|
|
ConditionGroup[] conditionGroups = customGrouper.getConditionGroups(); |
|
|
|
|
boolean more = customGrouper.isMore(); |
|
|
|
|
int other = customGrouper.getOther(); |
|
|
|
|
String odisplay = customGrouper.getOtherdisplay(); |
|
|
|
|
|
|
|
|
|
this.forceCheckBox.setSelected(force); |
|
|
|
|
|
|
|
|
|
this.moreCheckBox.setSelected(more); |
|
|
|
|
|
|
|
|
|
if (other == CustomGrouper.TOGETHER) { |
|
|
|
|
this.otherComboBox.setSelectedIndex(2); |
|
|
|
|
this.otherTextField.setEnabled(true); |
|
|
|
|
} else if (other == CustomGrouper.DISCARD) { |
|
|
|
|
this.otherComboBox.setSelectedIndex(0); |
|
|
|
|
this.otherTextField.setEnabled(false); |
|
|
|
|
} else { |
|
|
|
|
this.otherComboBox.setSelectedIndex(1); |
|
|
|
|
this.otherTextField.setEnabled(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (odisplay != null) { |
|
|
|
|
this.otherTextField.setText(odisplay); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (conditionGroups != null){ |
|
|
|
|
java.util.List<NameObject> list = new ArrayList<NameObject>(); |
|
|
|
|
for(int i = 0; i < conditionGroups.length; i++) { |
|
|
|
|
list.add(new NameObject(conditionGroups[i].getDisplay(), conditionGroups[i])); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
specifiedControlPane.populate(list.toArray(new NameObject[list.size()])); |
|
|
|
|
} |
|
|
|
|
} else if (grouper instanceof FunctionGrouper |
|
|
|
|
&& ((FunctionGrouper)grouper).isCustom()) { |
|
|
|
|
this.specifiedComboBox.setSelectedIndex(1); |
|
|
|
|
cardLayout.show(centerCardPane, "Formula"); |
|
|
|
|
formulaGroupPane.populate(grouper); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (otherComboBox.getSelectedIndex() == 2) { |
|
|
|
|
otherTextField.setEnabled(true); |
|
|
|
|
} else { |
|
|
|
@ -223,53 +223,52 @@ public class SpecifiedGroupAttrPane extends BasicPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public RecordGrouper update(CellElement cellElement, RecordGrouper recordGrouper) { |
|
|
|
|
if (this.specifiedComboBox.getSelectedIndex() == 0) { |
|
|
|
|
CustomGrouper customGroup = new CustomGrouper(); |
|
|
|
|
|
|
|
|
|
if (this.specifiedComboBox.getSelectedIndex() == 0) { |
|
|
|
|
CustomGrouper customGroup = new CustomGrouper(); |
|
|
|
|
|
|
|
|
|
if (forceCheckBox.isSelected()) { |
|
|
|
|
customGroup.setForce(true); |
|
|
|
|
customGroup.setForce(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!moreCheckBox.isSelected()) { |
|
|
|
|
customGroup.setMore(false); |
|
|
|
|
customGroup.setMore(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (otherComboBox.getSelectedIndex() == 2) { |
|
|
|
|
customGroup.setOther(CustomGrouper.TOGETHER); |
|
|
|
|
customGroup.setOther(CustomGrouper.TOGETHER); |
|
|
|
|
} else if (otherComboBox.getSelectedIndex() == 0) { |
|
|
|
|
customGroup.setOther(CustomGrouper.DISCARD); |
|
|
|
|
customGroup.setOther(CustomGrouper.DISCARD); |
|
|
|
|
} else { |
|
|
|
|
customGroup.setOther(CustomGrouper.LEAVE); |
|
|
|
|
customGroup.setOther(CustomGrouper.LEAVE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
customGroup.setOdisplay(this.otherTextField.getText()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Nameable[]居然不能强转成NameObject[],一定要这么写...
|
|
|
|
|
Nameable[] res = specifiedControlPane.update(); |
|
|
|
|
NameObject[] nameObject_array = new NameObject[res.length]; |
|
|
|
|
java.util.Arrays.asList(res).toArray(nameObject_array); |
|
|
|
|
ConditionGroup[] res_array = new ConditionGroup[res.length]; |
|
|
|
|
for (int i = 0; i < res.length; i++) { |
|
|
|
|
res_array[i] = (ConditionGroup) nameObject_array[i].getObject(); |
|
|
|
|
res_array[i].setDisplay(nameObject_array[i].getName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
customGroup.setConditionGroups(res_array); |
|
|
|
|
recordGrouper = customGroup; |
|
|
|
|
} else { |
|
|
|
|
recordGrouper = formulaGroupPane.update(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return recordGrouper; |
|
|
|
|
Nameable[] res = specifiedControlPane.update(); |
|
|
|
|
NameObject[] nameObject_array = new NameObject[res.length]; |
|
|
|
|
java.util.Arrays.asList(res).toArray(nameObject_array); |
|
|
|
|
ConditionGroup[] res_array = new ConditionGroup[res.length]; |
|
|
|
|
for (int i = 0; i < res.length; i ++) { |
|
|
|
|
res_array[i] = (ConditionGroup)nameObject_array[i].getObject(); |
|
|
|
|
res_array[i].setDisplay(nameObject_array[i].getName()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
customGroup.setConditionGroups(res_array); |
|
|
|
|
recordGrouper = customGroup; |
|
|
|
|
} else { |
|
|
|
|
recordGrouper = formulaGroupPane.update(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return recordGrouper; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static class ConditionGroupDetailsPane extends BasicBeanPane<ConditionGroup> { |
|
|
|
|
private ConditionGroup editing; |
|
|
|
|
|
|
|
|
|
private DSColumnLiteConditionPane liteConditionPane; |
|
|
|
|
|
|
|
|
|
public ConditionGroupDetailsPane(String[] displayNames) { |
|
|
|
|
//alex:右侧的组内的条件细节
|
|
|
|
|
private ConditionGroup editing; |
|
|
|
|
|
|
|
|
|
private DSColumnLiteConditionPane liteConditionPane; |
|
|
|
|
public ConditionGroupDetailsPane(String[] displayNames) { |
|
|
|
|
//alex:右侧的组内的条件细节
|
|
|
|
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
|
|
|
this.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); |
|
|
|
|
|
|
|
|
@ -286,19 +285,19 @@ public class SpecifiedGroupAttrPane extends BasicPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public ConditionGroup updateBean() { |
|
|
|
|
editing.setCondition(liteConditionPane.updateBean()); |
|
|
|
|
|
|
|
|
|
return editing; |
|
|
|
|
} |
|
|
|
|
public ConditionGroup updateBean() { |
|
|
|
|
editing.setCondition(liteConditionPane.updateBean()); |
|
|
|
|
|
|
|
|
|
return editing; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void populateBean(ConditionGroup ob) { |
|
|
|
|
editing = ob; |
|
|
|
|
liteConditionPane.populateBean(ob.getCondition()); |
|
|
|
|
} |
|
|
|
|
public void populateBean(ConditionGroup ob) { |
|
|
|
|
editing = ob; |
|
|
|
|
liteConditionPane.populateBean(ob.getCondition()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class FormulaGroupPane extends JPanel { |
|
|
|
|
|
|
|
|
|
private String[] displayModeNames = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_GROUPING_MODE"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_LIST_MODE"), |
|
|
|
@ -311,7 +310,7 @@ public class SpecifiedGroupAttrPane extends BasicPane {
|
|
|
|
|
private JPanel southPane; |
|
|
|
|
|
|
|
|
|
public FormulaGroupPane() { |
|
|
|
|
this.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("D-Dispaly_Divide_Result_Set_into_Groups"))); |
|
|
|
|
this.setBorder(BorderFactory.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_D_Dispaly_Divide_Result_Set_into_Groups"))); |
|
|
|
|
this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
|
|
|
|
JPanel contentPane = FRGUIPaneFactory.createNColumnGridInnerContainer_S_Pane(1); |
|
|
|
|
this.add(contentPane, BorderLayout.NORTH); |
|
|
|
@ -321,10 +320,10 @@ public class SpecifiedGroupAttrPane extends BasicPane {
|
|
|
|
|
contentPane.add(northPane); |
|
|
|
|
modeComboBox = new UIComboBox(displayModeNames); |
|
|
|
|
|
|
|
|
|
northPane.add(GUICoreUtils.createFlowPane(new JComponent[] { new UILabel(InsertText), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Display_Modes") + ": "), |
|
|
|
|
modeComboBox }, FlowLayout.LEFT), BorderLayout.WEST); |
|
|
|
|
|
|
|
|
|
UILabel label = new UILabel("="); |
|
|
|
|
northPane.add(GUICoreUtils.createFlowPane(new JComponent[] { new UILabel(InsertText), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Display_Modes") + ": "), |
|
|
|
|
modeComboBox }, FlowLayout.LEFT), BorderLayout.WEST); |
|
|
|
|
|
|
|
|
|
UILabel label = new UILabel("="); |
|
|
|
|
label.setFont(new Font("Dialog", Font.BOLD, 12)); |
|
|
|
|
valueField = new UITextField(16); |
|
|
|
|
valueField.setText("$$$"); |
|
|
|
@ -334,7 +333,7 @@ public class SpecifiedGroupAttrPane extends BasicPane {
|
|
|
|
|
formulaButton.setPreferredSize(new Dimension(25, valueField.getPreferredSize().height)); |
|
|
|
|
formulaButton.addActionListener(new ActionListener() { |
|
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
|
BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build(); |
|
|
|
|
BaseFormula valueFormula = BaseFormula.createFormulaBuilder().build(); |
|
|
|
|
String text = valueField.getText(); |
|
|
|
|
if (text == null || text.length() <= 0) { |
|
|
|
|
valueFormula.setContent("$$$"); |
|
|
|
@ -343,60 +342,60 @@ public class SpecifiedGroupAttrPane extends BasicPane {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); |
|
|
|
|
|
|
|
|
|
formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames == null ? new String[0] : displayNames, true)); |
|
|
|
|
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(FormulaGroupPane.this), new DialogActionAdapter() { |
|
|
|
|
@Override |
|
|
|
|
public void doOk() { |
|
|
|
|
BaseFormula valueFormula = formulaPane.update(); |
|
|
|
|
|
|
|
|
|
formulaPane.populate(valueFormula, new CustomVariableResolver(displayNames == null? new String[0] : displayNames, true)); |
|
|
|
|
formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(FormulaGroupPane.this), new DialogActionAdapter(){ |
|
|
|
|
@Override |
|
|
|
|
public void doOk() { |
|
|
|
|
BaseFormula valueFormula = formulaPane.update(); |
|
|
|
|
if (valueFormula.getContent().length() <= 1) { |
|
|
|
|
valueField.setText("$$$"); |
|
|
|
|
} else { |
|
|
|
|
valueField.setText(valueFormula.getContent().substring(1)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}).setVisible(true); |
|
|
|
|
} |
|
|
|
|
}).setVisible(true); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
southPane = GUICoreUtils.createFlowPane(new JComponent[]{new UILabel(InsertText), //new UILabel(com.fr.design.i18n.Toolkit.i18nText("I-Message_FunctionGrouper_2")),
|
|
|
|
|
new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Custom_Value") + ": "), label, valueField, formulaButton}, FlowLayout.LEFT); |
|
|
|
|
|
|
|
|
|
southPane = GUICoreUtils.createFlowPane(new JComponent[] {new UILabel(InsertText), //new UILabel(com.fr.design.i18n.Toolkit.i18nText("I-Message_FunctionGrouper_2")),
|
|
|
|
|
new UILabel(com.fr.design.i18n.Toolkit.i18nTextArray(new String[]{"Custom", "Value"}) + ": "), label, valueField, formulaButton}, FlowLayout.LEFT); |
|
|
|
|
contentPane.add(southPane); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// populate
|
|
|
|
|
public void populate(RecordGrouper grouper) { |
|
|
|
|
if (grouper instanceof FunctionGrouper) { |
|
|
|
|
int mode = ((FunctionGrouper) grouper).getDivideMode(); |
|
|
|
|
if (mode == FunctionGrouper.GROUPING_MODE) { |
|
|
|
|
this.modeComboBox.setSelectedIndex(0); |
|
|
|
|
} else if (mode == FunctionGrouper.LIST_MODE) { |
|
|
|
|
this.modeComboBox.setSelectedIndex(1); |
|
|
|
|
} else { |
|
|
|
|
this.modeComboBox.setSelectedIndex(2); |
|
|
|
|
} |
|
|
|
|
String formulaContent = ((FunctionGrouper) grouper).getFormulaContent(); |
|
|
|
|
if (formulaContent == null) { |
|
|
|
|
this.valueField.setText("$$$"); |
|
|
|
|
} else { |
|
|
|
|
this.valueField.setText(formulaContent); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public RecordGrouper update() { |
|
|
|
|
FunctionGrouper grouper = new FunctionGrouper(); |
|
|
|
|
grouper.setCustom(true); |
|
|
|
|
if (this.modeComboBox.getSelectedIndex() == 0) { |
|
|
|
|
grouper.setDivideMode(FunctionGrouper.GROUPING_MODE); |
|
|
|
|
} else if (this.modeComboBox.getSelectedIndex() == 1) { |
|
|
|
|
grouper.setDivideMode(FunctionGrouper.LIST_MODE); |
|
|
|
|
} else if (this.modeComboBox.getSelectedIndex() == 2) { |
|
|
|
|
grouper.setDivideMode(FunctionGrouper.CONTINUUM_MODE); |
|
|
|
|
} |
|
|
|
|
grouper.setFormulaContent(this.valueField.getText()); |
|
|
|
|
|
|
|
|
|
return grouper; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// populate
|
|
|
|
|
public void populate(RecordGrouper grouper) { |
|
|
|
|
if (grouper instanceof FunctionGrouper) { |
|
|
|
|
int mode = ((FunctionGrouper)grouper).getDivideMode(); |
|
|
|
|
if (mode == FunctionGrouper.GROUPING_MODE) { |
|
|
|
|
this.modeComboBox.setSelectedIndex(0); |
|
|
|
|
} else if (mode == FunctionGrouper.LIST_MODE) { |
|
|
|
|
this.modeComboBox.setSelectedIndex(1); |
|
|
|
|
} else { |
|
|
|
|
this.modeComboBox.setSelectedIndex(2); |
|
|
|
|
} |
|
|
|
|
String formulaContent = ((FunctionGrouper)grouper).getFormulaContent(); |
|
|
|
|
if(formulaContent == null) { |
|
|
|
|
this.valueField.setText("$$$"); |
|
|
|
|
} else { |
|
|
|
|
this.valueField.setText(formulaContent); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public RecordGrouper update() { |
|
|
|
|
FunctionGrouper grouper = new FunctionGrouper(); |
|
|
|
|
grouper.setCustom(true); |
|
|
|
|
if (this.modeComboBox.getSelectedIndex() == 0) { |
|
|
|
|
grouper.setDivideMode(FunctionGrouper.GROUPING_MODE); |
|
|
|
|
} else if (this.modeComboBox.getSelectedIndex() == 1) { |
|
|
|
|
grouper.setDivideMode(FunctionGrouper.LIST_MODE); |
|
|
|
|
} else if (this.modeComboBox.getSelectedIndex() == 2) { |
|
|
|
|
grouper.setDivideMode(FunctionGrouper.CONTINUUM_MODE); |
|
|
|
|
} |
|
|
|
|
grouper.setFormulaContent(this.valueField.getText()); |
|
|
|
|
|
|
|
|
|
return grouper; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|