Browse Source

Pull request #2137: CHART-15103 release/10.0 to Final/10.0

Merge in DESIGN/design from ~ZHENG/c-design:final/10.0 to final/10.0

* commit '0d341449424ff6017835950b9849761353e830d1':
  还原
  布局
final/10.0
Kara 4 years ago
parent
commit
ee8b5763e9
  1. 121
      designer-chart/src/main/java/com/fr/design/chartx/component/AbstractCustomFieldComboBoxPane.java
  2. 12
      designer-chart/src/main/java/com/fr/design/chartx/component/SeriesValueFieldComboBoxPane.java
  3. 69
      designer-chart/src/main/java/com/fr/design/chartx/data/DataLayoutHelper.java
  4. 15
      designer-chart/src/main/java/com/fr/design/chartx/data/map/AbstractAreaLngLatPane.java
  5. 1
      designer-chart/src/main/java/com/fr/design/chartx/data/map/MapChartDataPane.java
  6. 15
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java
  7. 15
      designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java
  8. 7
      designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java
  9. 2
      designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java
  10. 30
      designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java
  11. 22
      designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java
  12. 12
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java

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

@ -1,19 +1,18 @@
package com.fr.design.chartx.component;
import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane;
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.chartx.data.DataLayoutHelper;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.extended.chart.UIComboBoxWithNone;
@ -22,19 +21,25 @@ import com.fr.stable.StringUtils;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.util.ArrayList;
import java.util.List;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2018/9/12.
* 系列名使用字段名or字段值的抽象的pane 支持多种属性结构的存取
*/
public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<T> {
public abstract class AbstractCustomFieldComboBoxPane<T> extends BasicBeanPane<T> {
private UIButtonGroup<Boolean> nameOrValue;
private JPanel cardPane;
private CardLayout cardLayout;
private AbstractUseFieldValuePane useFieldValuePane;
@ -42,73 +47,43 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
private List<String> fieldList = new ArrayList<String>();
@Override
protected void initLayout() {
this.setLayout(new BorderLayout(0, 6));
JPanel northPane = new JPanel(new BorderLayout());
northPane.add(jcb, BorderLayout.CENTER);
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, 20));
northPane.add(label, BorderLayout.WEST);
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
}
public AbstractCustomFieldComboBoxPane() {
@Override
protected List<FurtherBasicBeanPane<? extends T>> initPaneList() {
useFieldValuePane = createUseFieldValuePane();
customFieldNamePane = createCustomFieldNamePane();
List<FurtherBasicBeanPane<? extends T>> list = new ArrayList<FurtherBasicBeanPane<? extends T>>();
list.add(useFieldValuePane);
list.add(paneWrapper());
return list;
}
private FurtherBasicBeanPane<? extends T> paneWrapper() {
FurtherBasicBeanPane pane = new FurtherBasicBeanPane() {
nameOrValue = new UIButtonGroup<Boolean>(
new String[]{useFieldValuePane.title4PopupWindow(), customFieldNamePane.title4PopupWindow()},
new Boolean[]{false, true});
nameOrValue.setSelectedItem(false);
nameOrValue.addChangeListener(new ChangeListener() {
@Override
public String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name");
public void stateChanged(ChangeEvent e) {
checkCardPane();
}
});
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"), nameOrValue);
@Override
public boolean accept(Object ob) {
return false;
}
@Override
public void reset() {
}
cardLayout = new CardLayout();
cardPane = new JPanel(cardLayout);
cardPane.add(useFieldValuePane, useFieldValuePane.title4PopupWindow());
cardPane.add(customFieldNamePane, customFieldNamePane.title4PopupWindow());
@Override
public void populateBean(Object ob) {
}
@Override
public Object updateBean() {
return null;
}
};
pane.setLayout(new BorderLayout(0, 6));
pane.add(customFieldNamePane, BorderLayout.CENTER);
return pane;
this.setLayout(new BorderLayout(0, 6));
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
}
protected abstract AbstractUseFieldValuePane createUseFieldValuePane();
protected abstract AbstractCustomFieldNamePane createCustomFieldNamePane();
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
protected boolean valueComboBoxHasNone() {
return false;
}
public void checkBoxUse(boolean hasUse) {
jcb.setEnabled(hasUse);
nameOrValue.setEnabled(hasUse);
useFieldValuePane.checkBoxUse(hasUse);
}
@ -122,6 +97,19 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
fieldList = columnNameList;
}
private void checkCardPane() {
cardLayout.show(cardPane, nameOrValue.getSelectedItem() ? customFieldNamePane.title4PopupWindow() : useFieldValuePane.title4PopupWindow());
}
protected void populateNameOrValue(boolean b) {
nameOrValue.setSelectedItem(b);
checkCardPane();
}
protected boolean updateNameOrValue() {
return nameOrValue.getSelectedItem();
}
protected void populateCustomFieldNamePane(T t) {
customFieldNamePane.populateBean(t);
}
@ -138,6 +126,16 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
useFieldValuePane.updateBean(t);
}
@Override
public T updateBean() {
return null;
}
@Override
protected String title4PopupWindow() {
return null;
}
protected abstract class AbstractUseFieldValuePane extends FurtherBasicBeanPane<T> {
private UIComboBox series;
private UIComboBox value;
@ -169,11 +167,7 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
new Component[]{new UILabel(Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), function},
};
double p = TableLayout.PREFERRED;
double[] columnSize = {78, 122};
double[] rowSize = {p, p, p};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
JPanel panel = DataLayoutHelper.createDataLayoutPane(components);
this.setLayout(new BorderLayout(0, 6));
this.add(panel, BorderLayout.CENTER);
@ -258,5 +252,10 @@ public abstract class AbstractCustomFieldComboBoxPane<T> extends UIComboBoxPane<
protected Object[] createLine() {
return new String[]{StringUtils.EMPTY, StringUtils.EMPTY, Toolkit.i18nText("Fine-Design_Chart_Use_None")};
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name");
}
}
}

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

@ -27,23 +27,21 @@ public class SeriesValueFieldComboBoxPane extends AbstractCustomFieldComboBoxPan
@Override
public void populateBean(SeriesValueCorrelationDefinition ob) {
populateNameOrValue(ob.isCustomFieldValue());
if (ob.isCustomFieldValue()) {
populateCustomFieldNamePane(ob);
jcb.setSelectedIndex(1);
} else {
populateUseFieldValuePane(ob);
jcb.setSelectedIndex(0);
}
}
@Override
public void updateBean(SeriesValueCorrelationDefinition ob) {
if (jcb.getSelectedIndex() == 0) {
ob.setCustomFieldValue(false);
updateUseFieldValuePane(ob);
} else {
ob.setCustomFieldValue(true);
ob.setCustomFieldValue(updateNameOrValue());
if (ob.isCustomFieldValue()) {
updateCustomFieldNamePane(ob);
} else {
updateUseFieldValuePane(ob);
}
}

69
designer-chart/src/main/java/com/fr/design/chartx/data/DataLayoutHelper.java

@ -0,0 +1,69 @@
package com.fr.design.chartx.data;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.Component;
import java.util.Arrays;
/**
* @author shine
* @version 10.0
* Created by shine on 2020/7/22
*/
public class DataLayoutHelper {
public static int WIDTH = 150;
public static int LABEL_HEIGHT = 20;
public static int LABEL_WIDTH = 65;
public static int LEFT_GAP = 15;
public static int RIGHT_GAP = 10;
public static void setWIDTH(int WIDTH) {
DataLayoutHelper.WIDTH = WIDTH;
}
public static void setLabelHeight(int labelHeight) {
LABEL_HEIGHT = labelHeight;
}
public static void setLabelWidth(int labelWidth) {
LABEL_WIDTH = labelWidth;
}
public static void setLeftGap(int leftGap) {
LEFT_GAP = leftGap;
}
public static void setRightGap(int rightGap) {
RIGHT_GAP = rightGap;
}
public static JPanel createDataLayoutPane(Component[][] components) {
int len = components.length;
double p = TableLayout.PREFERRED;
double[] columnSize = {DataLayoutHelper.LABEL_WIDTH, DataLayoutHelper.WIDTH};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
}
public static JPanel createDataLayoutPane(String label, Component component) {
Component[][] components = new Component[][]{
new Component[]{new UILabel(label, SwingConstants.LEFT), component}
};
return createDataLayoutPane(components);
}
public static void addNormalBorder(JComponent component) {
component.setBorder(BorderFactory.createEmptyBorder(0, DataLayoutHelper.LEFT_GAP, 0, DataLayoutHelper.RIGHT_GAP));
}
}

15
designer-chart/src/main/java/com/fr/design/chartx/data/map/AbstractAreaLngLatPane.java

@ -1,18 +1,15 @@
package com.fr.design.chartx.data.map;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.util.Arrays;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
@ -67,8 +64,10 @@ public abstract class AbstractAreaLngLatPane extends JPanel {
locationType.setSelectedIndex(0);
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("FR-Plugin_Design_Geographic_Location"), locationType);
this.setLayout(new BorderLayout(0, 6));
this.add(locationType, BorderLayout.NORTH);
this.add(northPane, BorderLayout.NORTH);
this.add(centerPane, BorderLayout.CENTER);
}
@ -103,12 +102,8 @@ public abstract class AbstractAreaLngLatPane extends JPanel {
for (int i = 0; i < len; i++) {
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]};
}
double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6);
return DataLayoutHelper.createDataLayoutPane(components);
}
}

1
designer-chart/src/main/java/com/fr/design/chartx/data/map/MapChartDataPane.java

@ -38,6 +38,7 @@ public class MapChartDataPane extends AbstractChartDataPane<MapChartDataDefiniti
VanChartMapPlot mapPlot = this.getVanChart().getPlot();
mapType = mapPlot == null ? mapType : mapPlot.getMapType();
}
AreaMapDataSetFieldsPane areaMapDataSetFieldsPane;
PointMapDataSetFieldsPane pointMapDataSetFieldsPane;
LineMapDataSetFieldsPane lineMapDataSetFieldsPane;

15
designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractCellDataFieldsPane.java

@ -3,17 +3,13 @@ package com.fr.design.chartx.fields;
import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.ColumnField;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.util.Arrays;
import java.awt.BorderLayout;
import java.awt.Component;
@ -46,8 +42,6 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
if (south != null) {
this.add(south, BorderLayout.SOUTH);
}
this.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
}
protected JPanel createCenterPane() {
@ -65,12 +59,7 @@ public abstract class AbstractCellDataFieldsPane<T extends AbstractColumnFieldCo
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]};
}
double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6);
return DataLayoutHelper.createDataLayoutPane(components);
}

15
designer-chart/src/main/java/com/fr/design/chartx/fields/AbstractDataSetFieldsPane.java

@ -4,25 +4,21 @@ import com.fr.chartx.data.field.AbstractColumnFieldCollection;
import com.fr.chartx.data.field.ColumnField;
import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.general.GeneralUtils;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.util.Arrays;
import java.util.List;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
import static com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper.refreshBoxItems;
@ -49,7 +45,6 @@ public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCol
protected void initComponents() {
this.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(6, 24, 0, 15));
JPanel north = createNorthPane(),
center = createCenterPane(),
@ -86,12 +81,8 @@ public abstract class AbstractDataSetFieldsPane<T extends AbstractColumnFieldCol
for (int i = 0; i < len; i++) {
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]};
}
double p = TableLayout.PREFERRED;
double[] columnSize = {ChartDataPane.LABEL_WIDTH, 122};
double[] rowSize = new double[len];
Arrays.fill(rowSize, p);
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 0, 6);
return DataLayoutHelper.createDataLayoutPane(components);
}
protected JPanel createSouthPane() {

7
designer-chart/src/main/java/com/fr/design/chartx/fields/diff/MapDataSetFieldsPane.java

@ -5,23 +5,24 @@ import com.fr.base.Utils;
import com.fr.chartx.TwoTuple;
import com.fr.chartx.data.field.diff.ColumnFieldCollectionWithSeriesValue;
import com.fr.design.chartx.component.MapAreaMatchPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionListener;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.plugin.chart.map.VanChartMapPlot;
import com.fr.plugin.chart.map.data.MapMatchResult;
import com.fr.plugin.chart.map.server.ChartGEOJSONHelper;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.tree.DefaultMutableTreeNode;
import java.util.Set;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Set;
/**
* @author Bjorn
@ -53,7 +54,7 @@ public abstract class MapDataSetFieldsPane<T extends ColumnFieldCollectionWithSe
public JPanel createAreaPanel(final UIComboBox areaBox) {
JPanel areaPanel = new JPanel(new BorderLayout(10, 0));
areaBox.setPreferredSize(new Dimension(91, 20));
areaBox.setPreferredSize(new Dimension(DataLayoutHelper.WIDTH - 10 - 20, DataLayoutHelper.LABEL_HEIGHT));
areaPanel.add(areaBox, BorderLayout.WEST);
UIButton uiButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/config.png"));
uiButton.addActionListener(new ActionListener() {

2
designer-chart/src/main/java/com/fr/design/chartx/single/CellDataPane.java

@ -2,6 +2,7 @@ package com.fr.design.chartx.single;
import com.fr.chartx.data.CellDataDefinition;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.i18n.Toolkit;
@ -23,6 +24,7 @@ public class CellDataPane extends FurtherBasicBeanPane<CellDataDefinition> {
this.setLayout(new BorderLayout());
this.add(cellDataFieldsPane, BorderLayout.CENTER);
DataLayoutHelper.addNormalBorder(this);
}
@Override

30
designer-chart/src/main/java/com/fr/design/chartx/single/DataSetPane.java

@ -3,25 +3,20 @@ package com.fr.design.chartx.single;
import com.fr.chartx.data.DataSetDefinition;
import com.fr.data.impl.NameTableData;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.DatabaseTableDataPane;
import com.fr.design.utils.gui.UIComponentUtils;
import java.util.List;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.List;
/**
* Created by shine on 2019/5/21.
*/
public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
private static final int TABLE_DATA_LABEL_LINE_WRAP_WIDTH = 65;
private static final int TABLE_DATA_PANE_WIDTH = 246;
private DatabaseTableDataPane tableDataPane;
@ -32,24 +27,27 @@ public class DataSetPane extends FurtherBasicBeanPane<DataSetDefinition> {
}
private void initComps(AbstractDataSetFieldsPane dataSetFieldsPane) {
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data"));
UIComponentUtils.setLineWrap(label, TABLE_DATA_LABEL_LINE_WRAP_WIDTH);
UIComponentUtils.setPreferedWidth(label, ChartDataPane.LABEL_WIDTH);
tableDataPane = new DatabaseTableDataPane(label) {
tableDataPane = new DatabaseTableDataPane(null) {
@Override
protected void userEvent() {
refreshBoxListAndTableName();
checkBoxUse();
}
@Override
protected void setBorder() {
}
};
tableDataPane.setPreferredSize(new Dimension(TABLE_DATA_PANE_WIDTH, tableDataPane.getPreferredSize().height));
this.dataSetFieldsPane = dataSetFieldsPane;
this.setLayout(new BorderLayout());
this.add(tableDataPane, BorderLayout.NORTH);
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Table_Data"), tableDataPane);
this.setLayout(new BorderLayout(0, 6));
this.add(northPane, BorderLayout.NORTH);
this.add(dataSetFieldsPane, BorderLayout.CENTER);
DataLayoutHelper.addNormalBorder(this);
checkBoxUse();
}

22
designer-chart/src/main/java/com/fr/design/chartx/single/SingleDataPane.java

@ -3,28 +3,22 @@ package com.fr.design.chartx.single;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chartx.data.DataLayoutHelper;
import com.fr.design.chartx.fields.AbstractCellDataFieldsPane;
import com.fr.design.chartx.fields.AbstractDataSetFieldsPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.util.ArrayList;
import java.util.List;
import java.awt.BorderLayout;
/**
* Created by shine on 2019/5/21.
*/
public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> {
private static final int TABLE_DATA_LABEL_LINE_WIDTH = 81;
private UIComboBoxPane<AbstractDataDefinition> comboBoxPane;
private DataSetPane dataSetPane;
@ -50,18 +44,12 @@ public class SingleDataPane extends BasicBeanPane<AbstractDataDefinition> {
}
protected void initLayout() {
this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE, 6));
JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0));
this.setLayout(new BorderLayout(0, 6));
JPanel northPane = DataLayoutHelper.createDataLayoutPane(Toolkit.i18nText("Fine-Design_Chart_Data_Source"), jcb);
DataLayoutHelper.addNormalBorder(northPane);
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Data_Source"));
UIComponentUtils.setPreferedWidth(label, TABLE_DATA_LABEL_LINE_WIDTH);
northPane.add(label,BorderLayout.WEST);
northPane.add(jcb, BorderLayout.CENTER);
northPane.setBorder(BorderFactory.createEmptyBorder(5,24,0,15));
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
}
@Override

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

@ -27,21 +27,19 @@ public class ExtendedCustomFieldComboBoxPane extends AbstractCustomFieldComboBox
public void populateBean(AbstractDataConfig ob) {
if (ob.isCustomName()) {
populateCustomFieldNamePane(ob);
jcb.setSelectedIndex(1);
} else {
populateUseFieldValuePane(ob);
jcb.setSelectedIndex(0);
}
populateNameOrValue(ob.isCustomName());
}
@Override
public void updateBean(AbstractDataConfig ob) {
if (jcb.getSelectedIndex() == 0) {
ob.setCustomName(false);
updateUseFieldValuePane(ob);
} else {
ob.setCustomName(true);
ob.setCustomName(updateNameOrValue());
if (ob.isCustomName()) {
updateCustomFieldNamePane(ob);
} else {
updateUseFieldValuePane(ob);
}
}

Loading…
Cancel
Save