Browse Source

代码质量

research/10.0
zheng 6 years ago
parent
commit
852907a1cc
  1. 214
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java
  2. 5
      designer-chart/src/main/java/com/fr/design/chartx/component/CellDataSeriesValueCorrelationPane.java
  3. 21
      designer-chart/src/main/java/com/fr/design/chartx/component/SeriesValueFieldComboBoxPane.java
  4. 28
      designer-chart/src/main/java/com/fr/design/chartx/component/correlation/AbstractCorrelationPane.java
  5. 45
      designer-chart/src/main/java/com/fr/design/chartx/component/correlation/CalculateComboBoxEditorComponent.java
  6. 3
      designer-chart/src/main/java/com/fr/design/chartx/component/correlation/FieldEditorComponentWrapper.java
  7. 4
      designer-chart/src/main/java/com/fr/design/chartx/component/correlation/TinyFormulaPaneEditorComponent.java
  8. 55
      designer-chart/src/main/java/com/fr/design/chartx/component/correlation/UIComboBoxEditorComponent.java
  9. 41
      designer-chart/src/main/java/com/fr/design/chartx/component/correlation/UITextFieldEditorComponent.java
  10. 15
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java

214
designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java

@ -2,14 +2,15 @@ package com.fr.design.chartx.component;
import com.fr.data.util.function.AbstractDataFunction; import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.event.UIObserverListener; import com.fr.design.chartx.component.correlation.AbstractCorrelationPane;
import com.fr.design.chartx.component.correlation.CalculateComboBoxEditorComponent;
import com.fr.design.chartx.component.correlation.FieldEditorComponentWrapper;
import com.fr.design.chartx.component.correlation.UIComboBoxEditorComponent;
import com.fr.design.chartx.component.correlation.UITextFieldEditorComponent;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.frpane.UICorrelationPane;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itable.UITable; import com.fr.design.i18n.Toolkit;
import com.fr.design.gui.itable.UITableEditor;
import com.fr.design.gui.itextfield.UITextField;
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.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
@ -19,17 +20,11 @@ import com.fr.extended.chart.UIComboBoxWithNone;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -38,7 +33,6 @@ import java.util.List;
* 系列名使用字段名or字段值的抽象的pane 支持多种属性结构的存取 * 系列名使用字段名or字段值的抽象的pane 支持多种属性结构的存取
*/ */
public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<T> { public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<T> {
private static final String[] HEADS = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")};
private AbstractUseFieldValuePane useFieldValuePane; private AbstractUseFieldValuePane useFieldValuePane;
@ -64,7 +58,31 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
customFieldNamePane = createCustomFieldNamePane(); customFieldNamePane = createCustomFieldNamePane();
List<FurtherBasicBeanPane<? extends T>> list = new ArrayList<FurtherBasicBeanPane<? extends T>>(); List<FurtherBasicBeanPane<? extends T>> list = new ArrayList<FurtherBasicBeanPane<? extends T>>();
list.add(useFieldValuePane); list.add(useFieldValuePane);
list.add(customFieldNamePane); FurtherBasicBeanPane pane = new FurtherBasicBeanPane() {
@Override
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name");
}
@Override
public boolean accept(Object ob) {
return false;
}
@Override
public void reset() {
}
@Override
public void populateBean(Object ob) {
}
@Override
public Object updateBean() {
return null;
}
};
list.add(pane);
return list; return list;
} }
@ -129,9 +147,9 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
function = new CalculateComboBox(); function = new CalculateComboBox();
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(HEADS[1], SwingConstants.LEFT), series}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name"), SwingConstants.LEFT), series},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value"), SwingConstants.LEFT), value}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Use_Value"), SwingConstants.LEFT), value},
new Component[]{new UILabel(HEADS[2], SwingConstants.LEFT), function}, new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), function},
}; };
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
@ -204,165 +222,25 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
} }
} }
protected abstract class AbstractCustomFieldNamePane<T> extends FurtherBasicBeanPane<T> { protected abstract class AbstractCustomFieldNamePane<T> extends AbstractCorrelationPane<T> {
private UICorrelationPane correlationPane;
public AbstractCustomFieldNamePane() {
initComponents();
}
private void initComponents() {
correlationPane = new UICorrelationPane(HEADS) {
@Override
protected ActionListener getAddButtonListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
tablePane.addLine(new String[]{StringUtils.EMPTY, StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")});
fireTargetChanged();
}
};
}
public UITableEditor createUITableEditor() { @Override
return new Editor() { protected FieldEditorComponentWrapper[] createFieldEditorComponentWrappers() {
return new FieldEditorComponentWrapper[]{
new UIComboBoxEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Field_Name")) {
@Override @Override
protected UICorrelationPane getParent() { protected List<String> items() {
return correlationPane; return fieldList;
} }
}; },
} new UITextFieldEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Series_Name")),
new CalculateComboBoxEditorComponent(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"))
}; };
this.setLayout(new BorderLayout());
this.add(correlationPane, BorderLayout.CENTER);
}
protected void populate(List<Object[]> list) {
correlationPane.populateBean(list);
}
protected List<Object[]> update() {
return correlationPane.updateBean();
}
@Override
public boolean accept(Object ob) {
return true;
}
@Override
public void reset() {
} }
@Override @Override
public String title4PopupWindow() { protected Object[] createLine() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name"); return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")};
}
@Override
public T updateBean() {
return null;
} }
} }
private abstract class Editor extends UITableEditor {
private JComponent editorComponent;
protected abstract UICorrelationPane getParent();
@Override
public Object getCellEditorValue() {
if (editorComponent instanceof UIComboBox) {
return ((UIComboBox) editorComponent).getSelectedItem();
} else if (editorComponent instanceof UITextField) {
return ((UITextField) editorComponent).getText();
} else if (editorComponent instanceof CalculateComboBox) {
return ((CalculateComboBox) editorComponent).getSelectedItem();
}
return super.getCellEditorValue();
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, final int row, int column) {
switch (column) {
case 0:
editorComponent = createComboBoxEdit(row, value);
break;
case 1:
editorComponent = createTextEdit(value);
break;
default:
editorComponent = createCalculateComboBox(value);
break;
}
return editorComponent;
}
private void setDefaultName(int row) {
UITable table = getParent().getTable();
Object object = table.getValueAt(row, 0);
if (object != null) {
table.setValueAt(object, row, 1);
}
}
private UIComboBox createComboBoxEdit(final int row, Object value) {
UIComboBox uiComboBox = new UIComboBox(fieldList.toArray());
uiComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
getParent().stopCellEditing();
getParent().fireTargetChanged();
setDefaultName(row);
}
});
if (value != null && StringUtils.isNotEmpty(value.toString())) {
uiComboBox.getModel().setSelectedItem(value);
} else {
uiComboBox.getModel().setSelectedItem(value);
}
return uiComboBox;
}
private UITextField createTextEdit(Object value) {
UITextField uiTextField = new UITextField();
if (value != null) {
uiTextField.setText(value.toString());
}
uiTextField.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
getParent().fireTargetChanged();
}
});
return uiTextField;
}
private CalculateComboBox createCalculateComboBox(Object value) {
CalculateComboBox calculateComboBox = new CalculateComboBox();
if (value != null) {
calculateComboBox.setSelectedItem(value);
}
calculateComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
getParent().stopCellEditing();
getParent().fireTargetChanged();
}
});
return calculateComboBox;
}
}
} }

5
designer-chart/src/main/java/com/fr/design/chartx/component/CellDataSeriesValueCorrelationPane.java

@ -39,7 +39,7 @@ public class CellDataSeriesValueCorrelationPane extends AbstractCorrelationPane<
} }
@Override @Override
protected SeriesValueCorrelationDefinition covertTableModelListToTBean(List<Object[]> tableValues) { protected void setTableModelListToTBean(List<Object[]> tableValues, SeriesValueCorrelationDefinition seriesValueCorrelationDefinition) {
List<SeriesValueField> seriesValueFieldList = new ArrayList<SeriesValueField>(); List<SeriesValueField> seriesValueFieldList = new ArrayList<SeriesValueField>();
for (Object[] oneLine : tableValues) { for (Object[] oneLine : tableValues) {
@ -51,9 +51,6 @@ public class CellDataSeriesValueCorrelationPane extends AbstractCorrelationPane<
seriesValueFieldList.add(seriesValueField); seriesValueFieldList.add(seriesValueField);
} }
SeriesValueCorrelationDefinition seriesValueCorrelationDefinition = new SeriesValueCorrelationDefinition();
seriesValueCorrelationDefinition.setSeriesValueFieldList(seriesValueFieldList); seriesValueCorrelationDefinition.setSeriesValueFieldList(seriesValueFieldList);
return seriesValueCorrelationDefinition;
} }
} }

21
designer-chart/src/main/java/com/fr/design/chartx/component/SeriesValueFieldComboBoxPane.java

@ -74,25 +74,24 @@ public class SeriesValueFieldComboBoxPane extends AbstractCustomFieldComboBoxPan
} }
private class CustomFieldNamePane extends AbstractCustomFieldNamePane<SeriesValueCorrelationDefinition> { private class CustomFieldNamePane extends AbstractCustomFieldNamePane<SeriesValueCorrelationDefinition> {
@Override @Override
public void populateBean(SeriesValueCorrelationDefinition definition) { protected List<Object[]> covertTBeanToTableModelList(SeriesValueCorrelationDefinition seriesValueCorrelationDefinition) {
List<Object[]> list = new ArrayList<Object[]>(); List<Object[]> list = new ArrayList<Object[]>();
for (SeriesValueField seriesValueField : definition.getSeriesValueFieldList()) { for (SeriesValueField seriesValueField : seriesValueCorrelationDefinition.getSeriesValueFieldList()) {
Object[] array = new Object[3]; Object[] array = new Object[]{
array[0] = seriesValueField.getSeries().getFieldName(); seriesValueField.getSeries().getFieldName(),
array[1] = seriesValueField.getValue().getFieldName(); seriesValueField.getValue().getFieldName(),
array[2] = DataPaneHelper.getFunctionString(seriesValueField.getValue().getDataFunction()); DataPaneHelper.getFunctionString(seriesValueField.getValue().getDataFunction())
};
list.add(array); list.add(array);
} }
populate(list); return list;
} }
@Override @Override
public void updateBean(SeriesValueCorrelationDefinition seriesValueCorrelationDefinition) { protected void setTableModelListToTBean(List<Object[]> tableValues, SeriesValueCorrelationDefinition seriesValueCorrelationDefinition) {
List<Object[]> list = update();
List<SeriesValueField> seriesValueFields = new ArrayList<SeriesValueField>(); List<SeriesValueField> seriesValueFields = new ArrayList<SeriesValueField>();
for (Object[] line : list) { for (Object[] line : tableValues) {
ColumnField series = new ColumnField(GeneralUtils.objectToString(line[0])); ColumnField series = new ColumnField(GeneralUtils.objectToString(line[0]));
ColumnField value = new ColumnField(GeneralUtils.objectToString(line[1])); ColumnField value = new ColumnField(GeneralUtils.objectToString(line[1]));
value.setDataFunction(DataPaneHelper.getFunctionByName(GeneralUtils.objectToString(line[2]))); value.setDataFunction(DataPaneHelper.getFunctionByName(GeneralUtils.objectToString(line[2])));

28
designer-chart/src/main/java/com/fr/design/chartx/component/correlation/AbstractCorrelationPane.java

@ -10,6 +10,8 @@ import javax.swing.JTable;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List; import java.util.List;
/** /**
@ -41,14 +43,19 @@ public abstract class AbstractCorrelationPane<T> extends BasicBeanPane<T> {
correlationPane.populateBean(covertTBeanToTableModelList(ob)); correlationPane.populateBean(covertTBeanToTableModelList(ob));
} }
@Override
public void updateBean(T ob) {
setTableModelListToTBean(correlationPane.updateBean(), ob);
}
@Override @Override
public T updateBean() { public T updateBean() {
return covertTableModelListToTBean(correlationPane.updateBean()); return null;
} }
protected abstract List<Object[]> covertTBeanToTableModelList(T t); protected abstract List<Object[]> covertTBeanToTableModelList(T t);
protected abstract T covertTableModelListToTBean(List<Object[]> tableValues); protected abstract void setTableModelListToTBean(List<Object[]> tableValues, T t);
private void initComps(String[] headers) { private void initComps(String[] headers) {
correlationPane = new UICorrelationPane(headers) { correlationPane = new UICorrelationPane(headers) {
@ -68,12 +75,27 @@ public abstract class AbstractCorrelationPane<T> extends BasicBeanPane<T> {
} }
}; };
} }
protected ActionListener getAddButtonListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
tablePane.addLine(createLine());
fireTargetChanged();
}
};
}
}; };
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(correlationPane, BorderLayout.CENTER); this.add(correlationPane, BorderLayout.CENTER);
} }
protected Object[] createLine() {
return new Object[this.editorComponents.length];
}
private class Editor extends UITableEditor { private class Editor extends UITableEditor {
private Component currentComponent; private Component currentComponent;
@ -92,7 +114,7 @@ public abstract class AbstractCorrelationPane<T> extends BasicBeanPane<T> {
currentEditorWrapper = AbstractCorrelationPane.this.editorComponents[column]; currentEditorWrapper = AbstractCorrelationPane.this.editorComponents[column];
currentComponent = currentEditorWrapper.createEditorComponent(correlationPane); currentComponent = currentEditorWrapper.getTableCellEditorComponent(correlationPane, table, isSelected, row, column);
currentEditorWrapper.setValue(currentComponent, value); currentEditorWrapper.setValue(currentComponent, value);
return currentComponent; return currentComponent;

45
designer-chart/src/main/java/com/fr/design/chartx/component/correlation/CalculateComboBoxEditorComponent.java

@ -0,0 +1,45 @@
package com.fr.design.chartx.component.correlation;
import com.fr.design.gui.frpane.UICorrelationPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import javax.swing.JTable;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* Created by shine on 2019/6/10.
*/
public class CalculateComboBoxEditorComponent extends AbstractEditorComponent<CalculateComboBox> {
public CalculateComboBoxEditorComponent(String header) {
super(header);
}
@Override
public CalculateComboBox getTableCellEditorComponent(final UICorrelationPane parent, JTable table, boolean isSelected, int row, int column) {
CalculateComboBox calculateComboBox = new CalculateComboBox();
calculateComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
parent.stopCellEditing();
parent.fireTargetChanged();
}
});
return calculateComboBox;
}
@Override
public Object getValue(CalculateComboBox calculateComboBox) {
return calculateComboBox.getSelectedItem();
}
@Override
public void setValue(CalculateComboBox calculateComboBox, Object o) {
if (o != null) {
calculateComboBox.setSelectedItem(o);
}
}
}

3
designer-chart/src/main/java/com/fr/design/chartx/component/correlation/FieldEditorComponentWrapper.java

@ -2,6 +2,7 @@ package com.fr.design.chartx.component.correlation;
import com.fr.design.gui.frpane.UICorrelationPane; import com.fr.design.gui.frpane.UICorrelationPane;
import javax.swing.JTable;
import java.awt.Component; import java.awt.Component;
/** /**
@ -11,7 +12,7 @@ public interface FieldEditorComponentWrapper<T extends Component> {
String headerName(); String headerName();
T createEditorComponent(UICorrelationPane parent); T getTableCellEditorComponent(UICorrelationPane parent, JTable table, boolean isSelected, final int row, int column);
Object getValue(T t); Object getValue(T t);

4
designer-chart/src/main/java/com/fr/design/chartx/component/correlation/TinyFormulaPaneEditorComponent.java

@ -7,6 +7,8 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.formula.TinyFormulaPane; import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.frpane.UICorrelationPane; import com.fr.design.gui.frpane.UICorrelationPane;
import javax.swing.JTable;
/** /**
* Created by shine on 2019/6/4. * Created by shine on 2019/6/4.
*/ */
@ -17,7 +19,7 @@ public class TinyFormulaPaneEditorComponent extends AbstractEditorComponent<Tiny
} }
@Override @Override
public TinyFormulaPane createEditorComponent(final UICorrelationPane parent) { public TinyFormulaPane getTableCellEditorComponent(final UICorrelationPane parent, JTable table, boolean isSelected, final int row, int column) {
TinyFormulaPane editorComponent = new TinyFormulaPane() { TinyFormulaPane editorComponent = new TinyFormulaPane() {
@Override @Override
public void okEvent() { public void okEvent() {

55
designer-chart/src/main/java/com/fr/design/chartx/component/correlation/UIComboBoxEditorComponent.java

@ -0,0 +1,55 @@
package com.fr.design.chartx.component.correlation;
import com.fr.design.gui.frpane.UICorrelationPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.itable.UITable;
import javax.swing.JTable;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2019/6/10.
*/
public class UIComboBoxEditorComponent extends AbstractEditorComponent<UIComboBox> {
public UIComboBoxEditorComponent(String header) {
super(header);
}
protected List<String> items() {
return new ArrayList<String>();
}
@Override
public UIComboBox getTableCellEditorComponent(final UICorrelationPane parent, JTable table, boolean isSelected, final int row, int column) {
UIComboBox uiComboBox = new UIComboBox(items().toArray());
uiComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
parent.stopCellEditing();
parent.fireTargetChanged();
UITable table = parent.getTable();
Object object = table.getValueAt(row, 0);
if (object != null) {
table.setValueAt(object, row, 1);
}
}
});
return uiComboBox;
}
@Override
public Object getValue(UIComboBox uiComboBox) {
return uiComboBox.getSelectedItem();
}
@Override
public void setValue(UIComboBox uiComboBox, Object o) {
uiComboBox.getModel().setSelectedItem(o);
}
}

41
designer-chart/src/main/java/com/fr/design/chartx/component/correlation/UITextFieldEditorComponent.java

@ -0,0 +1,41 @@
package com.fr.design.chartx.component.correlation;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.frpane.UICorrelationPane;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.general.GeneralUtils;
import javax.swing.JTable;
/**
* Created by shine on 2019/6/10.
*/
public class UITextFieldEditorComponent extends AbstractEditorComponent<UITextField> {
public UITextFieldEditorComponent(String header) {
super(header);
}
@Override
public UITextField getTableCellEditorComponent(final UICorrelationPane parent, JTable table, boolean isSelected, int row, int column) {
UITextField uiTextField = new UITextField();
uiTextField.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
parent.fireTargetChanged();
}
});
return uiTextField;
}
@Override
public Object getValue(UITextField uiTextField) {
return uiTextField.getText();
}
@Override
public void setValue(UITextField uiTextField, Object o) {
uiTextField.setText(GeneralUtils.objectToString(o));
}
}

15
designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java

@ -75,23 +75,21 @@ public class ExtendedCustomFieldComboBoxPane extends AbstractCustomFieldComboBox
private class ExtendedCustomFieldNamePane extends AbstractCustomFieldNamePane<AbstractDataConfig> { private class ExtendedCustomFieldNamePane extends AbstractCustomFieldNamePane<AbstractDataConfig> {
@Override @Override
public void populateBean(AbstractDataConfig ob) { protected List<Object[]> covertTBeanToTableModelList(AbstractDataConfig dataConfig) {
List<ExtendedField> customFields = ob.getCustomFields(); List<ExtendedField> customFields = dataConfig.getCustomFields();
List<Object[]> list = new ArrayList<Object[]>(); List<Object[]> list = new ArrayList<Object[]>();
for (ExtendedField field : customFields) { for (ExtendedField field : customFields) {
String[] array = {field.getFieldName(), field.getCustomName(), DataPaneHelper.getFunctionString(field.getDataFunction())}; String[] array = {field.getFieldName(), field.getCustomName(), DataPaneHelper.getFunctionString(field.getDataFunction())};
list.add(array); list.add(array);
} }
populate(list); return list;
} }
@Override @Override
public void updateBean(AbstractDataConfig ob) { protected void setTableModelListToTBean(List<Object[]> tableValues, AbstractDataConfig dataConfig) {
List<Object[]> list = update();
List<ExtendedField> customFields = new ArrayList<ExtendedField>(); List<ExtendedField> customFields = new ArrayList<ExtendedField>();
for (Object[] line : list) { for (Object[] line : tableValues) {
ExtendedField field = new ExtendedField(Utils.objectToString(line[0])); ExtendedField field = new ExtendedField(Utils.objectToString(line[0]));
field.setCustomName(Utils.objectToString(line[1])); field.setCustomName(Utils.objectToString(line[1]));
if (line.length > 2) { if (line.length > 2) {
@ -100,8 +98,9 @@ public class ExtendedCustomFieldComboBoxPane extends AbstractCustomFieldComboBox
customFields.add(field); customFields.add(field);
} }
ob.setCustomFields(customFields); dataConfig.setCustomFields(customFields);
} }
} }
} }

Loading…
Cancel
Save