|
|
@ -4,6 +4,7 @@ import com.fr.base.BaseUtils; |
|
|
|
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
|
|
|
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
|
|
|
import com.fr.chart.chartattr.Bar2DPlot; |
|
|
|
import com.fr.chart.chartattr.Bar2DPlot; |
|
|
|
import com.fr.chart.chartattr.ChartCollection; |
|
|
|
import com.fr.chart.chartattr.ChartCollection; |
|
|
|
|
|
|
|
import com.fr.chart.chartattr.Plot; |
|
|
|
import com.fr.chart.chartdata.NormalTableDataDefinition; |
|
|
|
import com.fr.chart.chartdata.NormalTableDataDefinition; |
|
|
|
import com.fr.design.event.UIObserver; |
|
|
|
import com.fr.design.event.UIObserver; |
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
@ -26,10 +27,11 @@ import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 多分类轴 的数据集定义界面. |
|
|
|
* 多分类轴 的数据集定义界面. |
|
|
|
|
|
|
|
* |
|
|
|
* @author kunsnat E-mail:kunsnat@gmail.com |
|
|
|
* @author kunsnat E-mail:kunsnat@gmail.com |
|
|
|
* @version 创建时间:2013-9-3 上午10:00:28 |
|
|
|
* @version 创建时间:2013-9-3 上午10:00:28 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableDataContentPane implements UIObserver{ |
|
|
|
public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableDataContentPane implements UIObserver { |
|
|
|
private static final long serialVersionUID = -3305681053750642843L; |
|
|
|
private static final long serialVersionUID = -3305681053750642843L; |
|
|
|
private static final int COMBOX_GAP = 8; |
|
|
|
private static final int COMBOX_GAP = 8; |
|
|
|
private static final int COMBOX_WIDTH = 95; |
|
|
|
private static final int COMBOX_WIDTH = 95; |
|
|
@ -42,6 +44,10 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD |
|
|
|
|
|
|
|
|
|
|
|
private UIObserverListener uiobListener = null; |
|
|
|
private UIObserverListener uiobListener = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<UIComboBox> getBoxList() { |
|
|
|
|
|
|
|
return boxList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public CategoryPlotMoreCateTableDataContentPane() { |
|
|
|
public CategoryPlotMoreCateTableDataContentPane() { |
|
|
|
// do nothing
|
|
|
|
// do nothing
|
|
|
|
} |
|
|
|
} |
|
|
@ -50,17 +56,17 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD |
|
|
|
categoryCombox = new UIComboBox(); |
|
|
|
categoryCombox = new UIComboBox(); |
|
|
|
categoryCombox.setPreferredSize(new Dimension(COMBOX_WIDTH,COMBOX_HEIGHT)); |
|
|
|
categoryCombox.setPreferredSize(new Dimension(COMBOX_WIDTH,COMBOX_HEIGHT)); |
|
|
|
|
|
|
|
|
|
|
|
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")) ; |
|
|
|
UILabel categoryLabel = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name")); |
|
|
|
categoryLabel.setPreferredSize(new Dimension(85,COMBOX_HEIGHT)); |
|
|
|
categoryLabel.setPreferredSize(new Dimension(85,COMBOX_HEIGHT)); |
|
|
|
|
|
|
|
|
|
|
|
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, COMBOX_HEIGHT)); |
|
|
|
addButton.setPreferredSize(new Dimension(20, COMBOX_HEIGHT)); |
|
|
|
|
|
|
|
|
|
|
|
categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, addButton,null,categoryLabel,null})); |
|
|
|
categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryCombox, addButton, null, categoryLabel, null})); |
|
|
|
categoryPane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
categoryPane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15)); |
|
|
|
|
|
|
|
|
|
|
|
boxPane = new JPanel(); |
|
|
|
boxPane = new JPanel(); |
|
|
|
boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); |
|
|
|
boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); |
|
|
@ -76,7 +82,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD |
|
|
|
addButton.addActionListener(new ActionListener() { |
|
|
|
addButton.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
if(boxList.size() < 2) { |
|
|
|
if (boxList.size() < 2) { |
|
|
|
addNewCombox(); |
|
|
|
addNewCombox(); |
|
|
|
relayoutPane(); |
|
|
|
relayoutPane(); |
|
|
|
} |
|
|
|
} |
|
|
@ -90,7 +96,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD |
|
|
|
checkSeriseUse(categoryCombox.getSelectedItem() != null); |
|
|
|
checkSeriseUse(categoryCombox.getSelectedItem() != null); |
|
|
|
makeToolTipUse(categoryCombox); |
|
|
|
makeToolTipUse(categoryCombox); |
|
|
|
|
|
|
|
|
|
|
|
checkAddButton(); |
|
|
|
checkComponent(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -109,7 +115,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD |
|
|
|
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)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -130,14 +136,14 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD |
|
|
|
boxPane.add(buttonPane); |
|
|
|
boxPane.add(buttonPane); |
|
|
|
boxList.add(combox); |
|
|
|
boxList.add(combox); |
|
|
|
|
|
|
|
|
|
|
|
checkAddButton(); |
|
|
|
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); |
|
|
|
boxList.remove(combox); |
|
|
|
boxList.remove(combox); |
|
|
|
checkAddButton(); |
|
|
|
checkComponent(); |
|
|
|
relayoutPane(); |
|
|
|
relayoutPane(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -151,25 +157,30 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD |
|
|
|
addButton.setEnabled(size < 2 && categoryCombox.getSelectedItem() != null); |
|
|
|
addButton.setEnabled(size < 2 && categoryCombox.getSelectedItem() != null); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void checkComponent() { |
|
|
|
|
|
|
|
checkAddButton(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void relayoutPane() { |
|
|
|
private void relayoutPane() { |
|
|
|
this.revalidate(); |
|
|
|
this.revalidate(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
*检查 某些Box是否可用 |
|
|
|
* 检查 某些Box是否可用 |
|
|
|
|
|
|
|
* |
|
|
|
* @param hasUse 是否使用. |
|
|
|
* @param hasUse 是否使用. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void checkBoxUse(boolean hasUse) { |
|
|
|
public void checkBoxUse(boolean hasUse) { |
|
|
|
super.checkBoxUse(hasUse); |
|
|
|
super.checkBoxUse(hasUse); |
|
|
|
|
|
|
|
|
|
|
|
checkAddButton(); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -194,6 +205,7 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 更新 多分类相关界面 |
|
|
|
* 更新 多分类相关界面 |
|
|
|
|
|
|
|
* |
|
|
|
* @param collection |
|
|
|
* @param collection |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void populateBean(ChartCollection collection) { |
|
|
|
public void populateBean(ChartCollection collection) { |
|
|
@ -202,10 +214,10 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD |
|
|
|
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; |
|
|
|
int size = normal.getMoreCateSize(); |
|
|
|
int size = normal.getMoreCateSize(); |
|
|
|
for(int i = 0; i < size; i++) { |
|
|
|
for (int i = 0; i < size; i++) { |
|
|
|
UIComboBox box = addNewCombox(); |
|
|
|
UIComboBox box = addNewCombox(); |
|
|
|
box.setSelectedItem(normal.getMoreCateWithIndex(i)); |
|
|
|
box.setSelectedItem(normal.getMoreCateWithIndex(i)); |
|
|
|
} |
|
|
|
} |
|
|
@ -217,21 +229,28 @@ public class CategoryPlotMoreCateTableDataContentPane extends CategoryPlotTableD |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 保存多分类界面到collection |
|
|
|
* 保存多分类界面到collection |
|
|
|
|
|
|
|
* |
|
|
|
* @param collection |
|
|
|
* @param collection |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void updateBean(ChartCollection collection) { |
|
|
|
public void updateBean(ChartCollection collection) { |
|
|
|
super.updateBean(collection); |
|
|
|
super.updateBean(collection); |
|
|
|
|
|
|
|
|
|
|
|
TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); |
|
|
|
TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); |
|
|
|
if(top instanceof NormalTableDataDefinition) { |
|
|
|
Plot plot = collection.getSelectedChart().getPlot(); |
|
|
|
NormalTableDataDefinition normal = (NormalTableDataDefinition)top; |
|
|
|
if (top instanceof NormalTableDataDefinition) { |
|
|
|
|
|
|
|
NormalTableDataDefinition normal = (NormalTableDataDefinition) top; |
|
|
|
normal.clearMoreCate(); |
|
|
|
normal.clearMoreCate(); |
|
|
|
for(int i = 0, size = boxList.size(); i < size; i++) { |
|
|
|
updateMoreCate(normal, plot); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void updateMoreCate(NormalTableDataDefinition normal, Plot plot) { |
|
|
|
|
|
|
|
for (int i = 0, size = boxList.size(); i < size; i++) { |
|
|
|
UIComboBox box = boxList.get(i); |
|
|
|
UIComboBox box = boxList.get(i); |
|
|
|
if(box.getSelectedItem() != null) { |
|
|
|
if (box.getSelectedItem() != null) { |
|
|
|
normal.addMoreCate(box.getSelectedItem().toString()); |
|
|
|
normal.addMoreCate(box.getSelectedItem().toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |