Browse Source

CHART-9760 系列名设置优化

feature/big-screen
白岳 4 years ago
parent
commit
476d396539
  1. 5
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java
  2. 125
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java
  3. 12
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java

5
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java

@ -14,15 +14,16 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.ChartDataPane; 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.CalculateComboBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.extended.chart.UIComboBoxWithNone;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.List;
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.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List;
/** /**
* 属性表 数据集 系列名使用 系列值 界面. * 属性表 数据集 系列名使用 系列值 界面.
@ -38,7 +39,7 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
private boolean isNeedSummary = true; private boolean isNeedSummary = true;
public SeriesNameUseFieldValuePane() { public SeriesNameUseFieldValuePane() {
seriesName = new UIComboBox(); seriesName = new UIComboBoxWithNone();
seriesValue = new UIComboBox(); seriesValue = new UIComboBox();
calculateCombox = new CalculateComboBox(); calculateCombox = new CalculateComboBox();
calculateCombox.reset(); calculateCombox.reset();

125
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesTypeUseComboxPane.java

@ -5,24 +5,25 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot; import com.fr.chart.chartattr.Plot;
import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.chart.chartdata.OneValueCDDefinition; import com.fr.chart.chartdata.OneValueCDDefinition;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
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.ilable.UILabel; 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.ChartDataPane;
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.UIComponentUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.util.ArrayList;
import java.util.List; import java.util.List;
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;
/** /**
* 属性表: 柱形, 饼图 数据集界面, "系列名使用"界面. * 属性表: 柱形, 饼图 数据集界面, "系列名使用"界面.
@ -30,7 +31,7 @@ import java.awt.Dimension;
* @author kunsnat E-mail:kunsnat@gmail.com * @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2012-12-26 下午03:17:08 * @version 创建时间2012-12-26 下午03:17:08
*/ */
public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> { public class SeriesTypeUseComboxPane extends BasicBeanPane<ChartCollection> {
private SeriesNameUseFieldValuePane nameFieldValuePane; private SeriesNameUseFieldValuePane nameFieldValuePane;
private SeriesNameUseFieldNamePane nameFieldNamePane; private SeriesNameUseFieldNamePane nameFieldNamePane;
@ -39,50 +40,100 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
private ChartDataPane parent; private ChartDataPane parent;
private Plot initplot; private Plot initplot;
private boolean isNeedSummary = true; private boolean isNeedSummary;
protected UIButtonGroup<Integer> content;
protected JPanel cardPane;
public SeriesTypeUseComboxPane(ChartDataPane parent, Plot initplot) { public SeriesTypeUseComboxPane(ChartDataPane parent, Plot initplot) {
this.initplot = initplot; this.initplot = initplot;
this.parent = parent; this.parent = parent;
cards = initPaneList();
this.isNeedSummary = true; this.isNeedSummary = true;
initComponents(); initComponents();
} }
protected void initComponents() {
nameFieldValuePane = createValuePane();
nameFieldNamePane = createNamePane();
cardPane = new JPanel(new CardLayout()) {
@Override
public Dimension getPreferredSize() {
if (content.getSelectedIndex() == 0) {
return nameFieldValuePane.getPreferredSize();
} else {
return nameFieldNamePane.getPreferredSize();
}
}
};
cardPane.add(nameFieldValuePane, nameFieldValuePane.title4PopupWindow());
cardPane.add(nameFieldNamePane, nameFieldNamePane.title4PopupWindow());
content = new UIButtonGroup<>(new String[]{nameFieldValuePane.title4PopupWindow(), nameFieldNamePane.title4PopupWindow()});
addItemChangeEvent();
initLayout();
content.setSelectedIndex(0);
}
private void addItemChangeEvent() {
content.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
checkCardPane();
}
});
}
protected void checkCardPane() {
comboBoxItemStateChanged();
CardLayout cl = (CardLayout) cardPane.getLayout();
if (content.getSelectedIndex() == 0) {
cl.show(cardPane, nameFieldValuePane.title4PopupWindow());
} else {
cl.show(cardPane, nameFieldNamePane.title4PopupWindow());
}
}
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM));
JPanel northPane = new JPanel(new BorderLayout(4, 0)); JPanel northPane = new JPanel(new BorderLayout(4, 0));
UILabel label1 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From")); UILabel label1 = new UILabel(Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT)); label1.setPreferredSize(new Dimension(ChartDataPane.LABEL_WIDTH, ChartDataPane.LABEL_HEIGHT));
northPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{jcb, null, null, label1, null})); JPanel borderLayoutPane = GUICoreUtils.createBorderLayoutPane(new Component[]{content, null, null, label1, null});
northPane.add(borderLayoutPane);
northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 15)); northPane.setBorder(BorderFactory.createEmptyBorder(10, 24, 0, 15));
cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15)); cardPane.setBorder(BorderFactory.createEmptyBorder(0, 24, 0, 15));
this.add(northPane, BorderLayout.NORTH); this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER); this.add(cardPane, BorderLayout.CENTER);
dataScreeningPane = new ChartDataFilterPane(this.initplot, parent); dataScreeningPane = new ChartDataFilterPane(this.initplot, parent);
JPanel panel = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 290, 24, dataScreeningPane); JPanel panel = new UIExpandablePane(Toolkit.i18nText("Fine-Design_Chart_Data_Filter"), 250, 24, dataScreeningPane);
panel.setBorder(BorderFactory.createEmptyBorder(0,5,0,5)); panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 15));
dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10,5,0,5)); dataScreeningPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
this.add(panel, BorderLayout.SOUTH); this.add(panel, BorderLayout.SOUTH);
} }
protected UIComboBox createComboBox() { public Dimension getPreferredSize() {
UIComboBox uiComboBox = new UIComboBox(); Dimension preferredSize = super.getPreferredSize();
UIComponentUtils.setPreferedWidth(uiComboBox, 100); return new Dimension(260, (int) preferredSize.getHeight());
return uiComboBox;
} }
/** /**
* 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用 * 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用
*
* @param hasUse 是否使用 * @param hasUse 是否使用
*/ */
public void checkUseBox(boolean hasUse) { public void checkUseBox(boolean hasUse) {
jcb.setEnabled(hasUse); content.setEnabled(hasUse);
nameFieldValuePane.checkUse(hasUse); nameFieldValuePane.checkUse(hasUse);
dataScreeningPane.checkBoxUse(); dataScreeningPane.checkBoxUse();
} }
/** /**
* 切换 变更数据集时, 刷新Box选中项目 * 切换 变更数据集时, 刷新Box选中项目
*
* @param list 列表 * @param list 列表
*/ */
public void refreshBoxListWithSelectTableData(List list) { public void refreshBoxListWithSelectTableData(List list) {
@ -93,28 +144,20 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
/** /**
* 清空所有的box设置 * 清空所有的box设置
*/ */
public void clearAllBoxList(){ public void clearAllBoxList() {
nameFieldValuePane.clearAllBoxList(); nameFieldValuePane.clearAllBoxList();
nameFieldNamePane.clearAllBoxList(); nameFieldNamePane.clearAllBoxList();
} }
/** /**
* 界面标题 * 界面标题
*
* @return 界面标题 * @return 界面标题
*/ */
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"); return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From");
} }
@Override
protected List<FurtherBasicBeanPane<? extends ChartCollection>> initPaneList() {
nameFieldValuePane = createValuePane();
nameFieldNamePane = createNamePane();
List<FurtherBasicBeanPane<? extends ChartCollection>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartCollection>>();
paneList.add(nameFieldValuePane);
paneList.add(nameFieldNamePane);
return paneList;
}
protected SeriesNameUseFieldValuePane createValuePane() { protected SeriesNameUseFieldValuePane createValuePane() {
return new SeriesNameUseFieldValuePane(); return new SeriesNameUseFieldValuePane();
@ -135,15 +178,17 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
nameFieldNamePane.populateBean(ob, isNeedSummary); nameFieldNamePane.populateBean(ob, isNeedSummary);
} }
dataScreeningPane.populateBean(ob, isNeedSummary); dataScreeningPane.populateBean(ob, isNeedSummary);
checkCardPane();
} }
/** /**
* 重新布局整个面板 * 重新布局整个面板
*
* @param isNeedSummary 是否需要汇总 * @param isNeedSummary 是否需要汇总
*/ */
public void relayoutPane(boolean isNeedSummary) { public void relayoutPane(boolean isNeedSummary) {
this.isNeedSummary = isNeedSummary; this.isNeedSummary = isNeedSummary;
if (jcb.getSelectedIndex() == 0) { if (this.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(this.isNeedSummary); nameFieldValuePane.relayoutPane(this.isNeedSummary);
} else { } else {
nameFieldNamePane.relayoutPane(this.isNeedSummary); nameFieldNamePane.relayoutPane(this.isNeedSummary);
@ -152,9 +197,8 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
} }
@Override
protected void comboBoxItemStateChanged() { protected void comboBoxItemStateChanged() {
if (jcb.getSelectedIndex() == 0) { if (this.getSelectedIndex() == 0) {
nameFieldValuePane.relayoutPane(this.isNeedSummary); nameFieldValuePane.relayoutPane(this.isNeedSummary);
} else { } else {
nameFieldNamePane.relayoutPane(this.isNeedSummary); nameFieldNamePane.relayoutPane(this.isNeedSummary);
@ -178,4 +222,21 @@ public class SeriesTypeUseComboxPane extends UIComboBoxPane<ChartCollection> {
dataScreeningPane.updateBean(ob); dataScreeningPane.updateBean(ob);
} }
/**
* 保存数据
*
* @return 待保存的对象
*/
public ChartCollection updateBean() {
return null;
}
public int getSelectedIndex() {
return content.getSelectedIndex();
}
public void setSelectedIndex(int index) {
content.setSelectedIndex(index);
}
} }

12
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/ThirdTabPane.java

@ -10,6 +10,7 @@ import com.fr.design.gui.ibutton.UIButtonGroup;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.border.Border; import javax.swing.border.Border;
import java.util.List;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
@ -20,7 +21,6 @@ import java.awt.Graphics2D;
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.List;
public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{ public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{
@ -74,16 +74,6 @@ public abstract class ThirdTabPane<T> extends BasicBeanPane<T>{
} }
} }
@Override
public void paint(Graphics g) {
super.paint(g);
if (!paneList.isEmpty()) {
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(UIConstants.LINE_COLOR);
g2d.drawLine(getWidth() - 2, tabPane.getPreferredSize().height, getWidth() - 2, getHeight() - 1);
}
}
protected void initLayout() { protected void initLayout() {
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
if (!paneList.isEmpty()) { if (!paneList.isEmpty()) {

Loading…
Cancel
Save