neil 7 years ago
parent
commit
d344e92e8b
  1. 16
      designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java
  2. 130
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java

16
designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java

@ -1,7 +1,7 @@
package com.fr.design.editor.editor; package com.fr.design.editor.editor;
import com.fr.data.SimpleDSColumn;
import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.DesignTableDataManager;
import com.fr.data.SimpleDSColumn;
import com.fr.design.data.datapane.TableDataComboBox; import com.fr.design.data.datapane.TableDataComboBox;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
@ -36,13 +36,13 @@ public class ColumnSelectedEditor extends Editor<SimpleDSColumn> {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
TableDataWrapper tableDataWrapper = tableDataComboBox.getSelectedItem(); TableDataWrapper tableDataWrapper = tableDataComboBox.getSelectedItem();
if (tableDataWrapper == null) { if (tableDataWrapper == null) {
return; return;
} }
//这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。 //这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。
List<String> nameList = tableDataWrapper.calculateColumnNameList(); List<String> nameList = tableDataWrapper.calculateColumnNameList();
columnNames = new String[nameList.size()]; columnNames = new String[nameList.size()];
columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames); columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames);
columnNameComboBox.removeAllItems(); columnNameComboBox.removeAllItems();
for (int i = 0; i < columnNames.length; i++) { for (int i = 0; i < columnNames.length; i++) {

130
designer_chart/src/com/fr/design/mainframe/chart/gui/data/table/CategoryPlotMoreCateTableDataContentPane.java

@ -37,10 +37,10 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
private static final int COMBOX_HEIGHT = 20; private static final int COMBOX_HEIGHT = 20;
private JPanel boxPane; private JPanel boxPane;
private ArrayList<UIComboBox> boxList = new ArrayList<UIComboBox>(); private ArrayList<UIComboBox> boxList = new ArrayList<UIComboBox>();
private UIButton addButton; private UIButton addButton;
private UIObserverListener uiobListener = null; private UIObserverListener uiobListener = null;
public List<UIComboBox> getBoxList() { public List<UIComboBox> getBoxList() {
@ -50,31 +50,31 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
public CategoryPlotMoreCateTableDataContentPane() { public CategoryPlotMoreCateTableDataContentPane() {
// do nothing // do nothing
} }
public CategoryPlotMoreCateTableDataContentPane(ChartDataPane parent) { public CategoryPlotMoreCateTableDataContentPane(ChartDataPane parent) {
categoryCombox = new UIComboBox(); categoryCombox = new UIComboBox();
categoryCombox.setPreferredSize(new Dimension(100,20)); categoryCombox.setPreferredSize(new Dimension(100,20));
JPanel categoryPane = new JPanel(new BorderLayout(4,0)); JPanel categoryPane = new JPanel(new BorderLayout(4,0));
categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground()));
UILabel categoryLabel = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT) ; UILabel categoryLabel = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT) ;
categoryLabel.setPreferredSize(new Dimension(75,20)); categoryLabel.setPreferredSize(new Dimension(75,20));
addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
addButton.setPreferredSize(new Dimension(20, 20)); addButton.setPreferredSize(new Dimension(20, 20));
categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, addButton,null,categoryLabel,null})); categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, addButton,null,categoryLabel,null}));
boxPane = new JPanel(); boxPane = new JPanel();
boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS));
categoryPane.add(boxPane, BorderLayout.SOUTH); categoryPane.add(boxPane, BorderLayout.SOUTH);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout());
this.add(categoryPane, BorderLayout.NORTH); this.add(categoryPane, BorderLayout.NORTH);
seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot()); seriesTypeComboxPane = new SeriesTypeUseComboxPane(parent, new Bar2DPlot());
this.add(seriesTypeComboxPane, BorderLayout.SOUTH); this.add(seriesTypeComboxPane, BorderLayout.SOUTH);
addButton.addActionListener(new ActionListener() { addButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -82,11 +82,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
addNewCombox(); addNewCombox();
relayoutPane(); relayoutPane();
} }
checkSeriseUse(categoryCombox.getSelectedItem() != null); checkSeriseUse(categoryCombox.getSelectedItem() != null);
} }
}); });
categoryCombox.addItemListener(new ItemListener() { categoryCombox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
checkSeriseUse(categoryCombox.getSelectedItem() != null); checkSeriseUse(categoryCombox.getSelectedItem() != null);
@ -96,45 +96,45 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
} }
}); });
} }
protected void checkSeriseUse(boolean hasUse) { protected void checkSeriseUse(boolean hasUse) {
super.checkSeriseUse(hasUse); super.checkSeriseUse(hasUse);
addButton.setEnabled(hasUse); addButton.setEnabled(hasUse);
} }
private UIComboBox addNewCombox() { private UIComboBox addNewCombox() {
final JPanel buttonPane = new JPanel(); final JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2)); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 2));
final UIComboBox combox = new UIComboBox(); final UIComboBox combox = new UIComboBox();
combox.setPreferredSize(new Dimension(COMBOX_WIDTH, COMBOX_HEIGHT)); combox.setPreferredSize(new Dimension(COMBOX_WIDTH, COMBOX_HEIGHT));
int count = categoryCombox.getItemCount(); int count = categoryCombox.getItemCount();
for(int i = 0; i < count; i++) { for(int i = 0; i < count; i++) {
combox.addItem(categoryCombox.getItemAt(i)); combox.addItem(categoryCombox.getItemAt(i));
} }
combox.registerChangeListener(uiobListener); combox.registerChangeListener(uiobListener);
combox.addItemListener(new ItemListener() { combox.addItemListener(new ItemListener() {
@Override @Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
makeToolTipUse(combox); makeToolTipUse(combox);
} }
}); });
combox.setSelectedItem(categoryCombox.getItemAt(0)); combox.setSelectedItem(categoryCombox.getItemAt(0));
makeToolTipUse(combox); makeToolTipUse(combox);
buttonPane.add(combox); buttonPane.add(combox);
UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png")); UIButton delButton = new UIButton(BaseUtils.readIcon("com/fr/design/images/toolbarbtn/close.png"));
buttonPane.add(delButton); buttonPane.add(delButton);
boxPane.add(buttonPane); boxPane.add(buttonPane);
boxList.add(combox); boxList.add(combox);
checkComponent(); checkComponent();
delButton.addActionListener(new ActionListener() { delButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
boxPane.remove(buttonPane); boxPane.remove(buttonPane);
@ -143,11 +143,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
relayoutPane(); relayoutPane();
} }
}); });
delButton.registerChangeListener(uiobListener); delButton.registerChangeListener(uiobListener);
return combox; return combox;
} }
private void checkAddButton() { private void checkAddButton() {
int size = boxList.size(); int size = boxList.size();
addButton.setEnabled(size < 2 && categoryCombox.getSelectedItem() != null); addButton.setEnabled(size < 2 && categoryCombox.getSelectedItem() != null);
@ -156,11 +156,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
protected void checkComponent() { protected void checkComponent() {
checkAddButton(); checkAddButton();
} }
private void relayoutPane() { private void relayoutPane() {
this.revalidate(); this.revalidate();
} }
/** /**
*检查 某些Box是否可用 *检查 某些Box是否可用
@ -171,14 +171,14 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
checkComponent(); checkComponent();
} }
protected void refreshBoxListWithSelectTableData(List list) { protected void refreshBoxListWithSelectTableData(List list) {
super.refreshBoxListWithSelectTableData(list); super.refreshBoxListWithSelectTableData(list);
for(int i = 0, size = boxList.size(); i < size; i++) { for(int i = 0, size = boxList.size(); i < size; i++) {
refreshBoxItems(boxList.get(i), list); refreshBoxItems(boxList.get(i), list);
} }
} }
/** /**
* 给组件登记一个观察者监听事件 * 给组件登记一个观察者监听事件
@ -204,9 +204,9 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
*/ */
public void populateBean(ChartCollection collection) { public void populateBean(ChartCollection collection) {
super.populateBean(collection); super.populateBean(collection);
boxList.clear(); boxList.clear();
TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition();
if(top instanceof NormalTableDataDefinition) { if(top instanceof NormalTableDataDefinition) {
NormalTableDataDefinition normal = (NormalTableDataDefinition)top; NormalTableDataDefinition normal = (NormalTableDataDefinition)top;
@ -216,11 +216,11 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD
box.setSelectedItem(normal.getMoreCateWithIndex(i)); box.setSelectedItem(normal.getMoreCateWithIndex(i));
} }
} }
checkAddButton(); checkAddButton();
checkSeriseUse(categoryCombox.getSelectedItem() != null); checkSeriseUse(categoryCombox.getSelectedItem() != null);
} }
/** /**
* 保存多分类界面到collection * 保存多分类界面到collection
* @param collection * @param collection

Loading…
Cancel
Save