Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~henry.wang/design into release/10.0

feature/big-screen
Henry.Wang 4 years ago
parent
commit
144ca48d0f
  1. 98
      designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableSeriesTypeUsePane.java

98
designer-chart/src/main/java/com/fr/van/chart/box/data/table/BoxPlotTableSeriesTypeUsePane.java

@ -5,9 +5,10 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.NormalTableDataDefinition; import com.fr.chart.chartdata.NormalTableDataDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.gui.frpane.UIComboBoxPane; import com.fr.design.gui.ibutton.UIButtonGroup;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.BoldFontTextLabel;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
@ -15,7 +16,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper; import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.plugin.chart.box.data.VanBoxTableDefinition; import com.fr.plugin.chart.box.data.VanBoxTableDefinition;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -24,47 +24,91 @@ import com.fr.stable.StringUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout;
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.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollection> { public class BoxPlotTableSeriesTypeUsePane extends BasicBeanPane<ChartCollection> {
private static boolean NEED_SUMMERY = false; private static final boolean NEED_SUMMERY = false;
private UIComboBox categoryCombox; private UIComboBox categoryCombox;
private BoxPlotTableSeriesNameUseFieldValuePane nameFieldValuePane; private BoxPlotTableSeriesNameUseFieldValuePane nameFieldValuePane;
private BoxPlotTableSeriesNameUseFieldNamePane nameFieldNamePane; private BoxPlotTableSeriesNameUseFieldNamePane nameFieldNamePane;
private UIButtonGroup<Integer> seriesFrom;
private JPanel cardPane;
public BoxPlotTableSeriesTypeUsePane() { public BoxPlotTableSeriesTypeUsePane() {
cards = initPaneList();
initComponents(); initComponents();
initLayout();
initListener(); initListener();
} }
protected void initLayout() { private void initComponents() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); nameFieldValuePane = new BoxPlotTableSeriesNameUseFieldValuePane();
nameFieldNamePane = new BoxPlotTableSeriesNameUseFieldNamePane();
nameFieldValuePane.relayoutPane(NEED_SUMMERY);
nameFieldNamePane.relayoutPane(NEED_SUMMERY);
cardPane = new JPanel(new CardLayout()) {
public Dimension getPreferredSize() {
if (seriesFrom.getSelectedIndex() == 0) {
return nameFieldValuePane.getPreferredSize();
} else {
return nameFieldNamePane.getPreferredSize();
}
}
};
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
cardPane.add(nameFieldValuePane, nameFieldValuePane.title4PopupWindow());
cardPane.add(nameFieldNamePane, nameFieldNamePane.title4PopupWindow());
seriesFrom = new UIButtonGroup<>(new String[]{nameFieldValuePane.title4PopupWindow(), nameFieldNamePane.title4PopupWindow()});
seriesFrom.setSelectedIndex(0);
addItemChangeEvent();
}
private void addItemChangeEvent() {
seriesFrom.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
}
private void checkCardPane() {
comboBoxItemStateChanged();
CardLayout cl = (CardLayout) cardPane.getLayout();
if (seriesFrom.getSelectedIndex() == 0) {
cl.show(cardPane, nameFieldValuePane.title4PopupWindow());
} else {
cl.show(cardPane, nameFieldNamePane.title4PopupWindow());
}
}
private void initLayout() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM));
this.add(createNorthPane(), BorderLayout.NORTH); this.add(createNorthPane(), BorderLayout.NORTH);
this.add(createCenterPane(), BorderLayout.CENTER); this.add(createCenterPane(), BorderLayout.CENTER);
this.add(cardPane, BorderLayout.SOUTH); this.add(cardPane, BorderLayout.SOUTH);
} }
protected UIComboBox createComboBox() {
UIComboBox uiComboBox = new UIComboBox();
UIComponentUtils.setPreferedWidth(uiComboBox, 100);
return uiComboBox;
}
private JPanel createNorthPane() { private JPanel createNorthPane() {
JPanel north = new JPanel(new BorderLayout(4, 0)); JPanel north = new JPanel(new BorderLayout(4, 0));
north.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); north.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, getBackground()));
UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category")); UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Style_Category"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
@ -74,8 +118,8 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
categoryCombox.setSelectedItem(null); categoryCombox.setSelectedItem(null);
north.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, null, null, label, null})); north.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, null, null, label, null}));
north.setPreferredSize(new Dimension(246, 30)); north.setPreferredSize(new Dimension(246, 20));
north.setBorder(BorderFactory.createEmptyBorder(0, 24, 10, 15)); north.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
return north; return north;
} }
@ -85,7 +129,7 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); UILabel label = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
center.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label, null})); center.add(GUICoreUtils.createBorderLayoutPane(new Component[]{seriesFrom, null, null, label, null}));
center.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); center.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
return center; return center;
@ -102,7 +146,7 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
public void checkBoxUse(boolean hasUse) { public void checkBoxUse(boolean hasUse) {
categoryCombox.setEnabled(hasUse); categoryCombox.setEnabled(hasUse);
jcb.setEnabled(hasUse); seriesFrom.setEnabled(hasUse);
nameFieldValuePane.checkUse(hasUse); nameFieldValuePane.checkUse(hasUse);
} }
@ -152,15 +196,15 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
} }
public void relayoutPane() { public void relayoutPane() {
if (jcb.getSelectedIndex() == 0) { if (seriesFrom.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(NEED_SUMMERY); nameFieldValuePane.relayoutPane(NEED_SUMMERY);
} else { } else {
nameFieldNamePane.relayoutPane(NEED_SUMMERY); nameFieldNamePane.relayoutPane(NEED_SUMMERY);
} }
} }
protected void comboBoxItemStateChanged() { private void comboBoxItemStateChanged() {
if (jcb.getSelectedIndex() == 0) { if (seriesFrom.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(NEED_SUMMERY); nameFieldValuePane.relayoutPane(NEED_SUMMERY);
} else { } else {
nameFieldNamePane.relayoutPane(NEED_SUMMERY); nameFieldNamePane.relayoutPane(NEED_SUMMERY);
@ -176,14 +220,16 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
} }
if (definition instanceof OneValueCDDefinition) { if (definition instanceof OneValueCDDefinition) {
this.setSelectedIndex(0); seriesFrom.setSelectedIndex(0);
nameFieldValuePane.populateDefinition(definition, NEED_SUMMERY); nameFieldValuePane.populateDefinition(definition, NEED_SUMMERY);
} else if (definition instanceof MoreNameCDDefinition) { } else if (definition instanceof MoreNameCDDefinition) {
this.setSelectedIndex(1); seriesFrom.setSelectedIndex(1);
nameFieldNamePane.populateDefinition(definition, NEED_SUMMERY); nameFieldNamePane.populateDefinition(definition, NEED_SUMMERY);
} }
populateCategoryItem(categoryCombox, definition.getCategoryName()); populateCategoryItem(categoryCombox, definition.getCategoryName());
checkCardPane();
} }
public void updateBean(ChartCollection collection) { public void updateBean(ChartCollection collection) {
@ -195,7 +241,7 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
NormalTableDataDefinition definition; NormalTableDataDefinition definition;
if (this.getSelectedIndex() == 0) { if (seriesFrom.getSelectedIndex() == 0) {
definition = nameFieldValuePane.updateDefinition(); definition = nameFieldValuePane.updateDefinition();
} else { } else {
definition = nameFieldNamePane.updateDefinition(table.getDetailedDefinition()); definition = nameFieldNamePane.updateDefinition(table.getDetailedDefinition());
@ -222,4 +268,8 @@ public class BoxPlotTableSeriesTypeUsePane extends UIComboBoxPane<ChartCollectio
} }
} }
public ChartCollection updateBean() {
return null;
}
} }

Loading…
Cancel
Save