|
|
@ -5,6 +5,7 @@ import com.fr.base.Utils; |
|
|
|
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.NormalReportDataDefinition; |
|
|
|
import com.fr.chart.chartdata.NormalReportDataDefinition; |
|
|
|
import com.fr.design.event.UIObserver; |
|
|
|
import com.fr.design.event.UIObserver; |
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
|
import com.fr.design.event.UIObserverListener; |
|
|
@ -21,6 +22,7 @@ import java.awt.*; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.ActionListener; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -37,40 +39,44 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor |
|
|
|
private ArrayList<TinyFormulaPane> formualList = new ArrayList<TinyFormulaPane>(); |
|
|
|
private ArrayList<TinyFormulaPane> formualList = new ArrayList<TinyFormulaPane>(); |
|
|
|
private UIObserverListener uiobListener = null; |
|
|
|
private UIObserverListener uiobListener = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<TinyFormulaPane> getFormualList() { |
|
|
|
|
|
|
|
return formualList; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public CategoryPlotMoreCateReportDataContentPane() { |
|
|
|
public CategoryPlotMoreCateReportDataContentPane() { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public CategoryPlotMoreCateReportDataContentPane(ChartDataPane parent) { |
|
|
|
public CategoryPlotMoreCateReportDataContentPane(ChartDataPane parent) { |
|
|
|
initEveryPane(); |
|
|
|
initEveryPane(); |
|
|
|
categoryName = initCategoryBox(Inter.getLocText("FR-Chart-Category_Name")); |
|
|
|
categoryName = initCategoryBox(Inter.getLocText("FR-Chart-Category_Name")); |
|
|
|
|
|
|
|
|
|
|
|
JPanel catePane = new JPanel(); |
|
|
|
JPanel catePane = new JPanel(); |
|
|
|
catePane.setLayout(new BorderLayout(2, 2)); |
|
|
|
catePane.setLayout(new BorderLayout(2, 2)); |
|
|
|
|
|
|
|
|
|
|
|
catePane.add(categoryName); |
|
|
|
catePane.add(categoryName); |
|
|
|
|
|
|
|
|
|
|
|
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)); |
|
|
|
catePane.add(addButton, BorderLayout.EAST); |
|
|
|
catePane.add(addButton, BorderLayout.EAST); |
|
|
|
|
|
|
|
|
|
|
|
boxPane = new JPanel(); |
|
|
|
boxPane = new JPanel(); |
|
|
|
boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); |
|
|
|
boxPane.setLayout(new BoxLayout(boxPane, BoxLayout.Y_AXIS)); |
|
|
|
|
|
|
|
|
|
|
|
boxPane.setBackground(Color.red); |
|
|
|
boxPane.setBackground(Color.red); |
|
|
|
|
|
|
|
|
|
|
|
catePane.add(boxPane, BorderLayout.SOUTH); |
|
|
|
catePane.add(boxPane, BorderLayout.SOUTH); |
|
|
|
|
|
|
|
|
|
|
|
catePane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15)); |
|
|
|
catePane.setBorder(BorderFactory.createEmptyBorder(0,24,10,15)); |
|
|
|
|
|
|
|
|
|
|
|
this.add(catePane, "0,0,2,0"); |
|
|
|
this.add(catePane, "0,0,2,0"); |
|
|
|
filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent); |
|
|
|
filterPane = new ChartDataFilterPane(new Bar2DPlot(), parent); |
|
|
|
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("FR-Chart-Data_Filter"),filterPane); |
|
|
|
JPanel panel = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Inter.getLocText("FR-Chart-Data_Filter"),filterPane); |
|
|
|
panel.setBorder(getSidesBorder()); |
|
|
|
panel.setBorder(getSidesBorder()); |
|
|
|
filterPane.setBorder(getFilterPaneBorder()); |
|
|
|
filterPane.setBorder(getFilterPaneBorder()); |
|
|
|
this.add(panel, "0,6,2,4"); |
|
|
|
this.add(panel, "0,6,2,4"); |
|
|
|
|
|
|
|
|
|
|
|
addButton.addActionListener(new ActionListener() { |
|
|
|
addButton.addActionListener(new ActionListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
addNewCatePane(); |
|
|
|
addNewCatePane(); |
|
|
@ -79,14 +85,14 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 检查box 是否应该可用状态. |
|
|
|
* 检查box 是否应该可用状态. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void checkBoxUse() { |
|
|
|
public void checkBoxUse() { |
|
|
|
super.checkBoxUse(); |
|
|
|
super.checkBoxUse(); |
|
|
|
String text = categoryName.getUITextField().getText(); |
|
|
|
String text = categoryName.getUITextField().getText(); |
|
|
|
addButton.setEnabled(StringUtils.isNotEmpty(text)); |
|
|
|
addButton.setEnabled(StringUtils.isNotEmpty(text)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private TinyFormulaPane addNewCatePane() { |
|
|
|
private TinyFormulaPane addNewCatePane() { |
|
|
|
final TinyFormulaPane pane = initCategoryBox(StringUtils.EMPTY); |
|
|
|
final TinyFormulaPane pane = initCategoryBox(StringUtils.EMPTY); |
|
|
@ -110,13 +116,13 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
boxPane.remove(newButtonPane); |
|
|
|
boxPane.remove(newButtonPane); |
|
|
|
formualList.remove(pane); |
|
|
|
formualList.remove(pane); |
|
|
|
checkAddButton(); |
|
|
|
checkComponent(); |
|
|
|
relayoutPane(); |
|
|
|
relayoutPane(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
delButton.registerChangeListener(uiobListener); |
|
|
|
delButton.registerChangeListener(uiobListener); |
|
|
|
|
|
|
|
|
|
|
|
checkAddButton(); |
|
|
|
checkComponent(); |
|
|
|
relayoutPane(); |
|
|
|
relayoutPane(); |
|
|
|
|
|
|
|
|
|
|
|
return pane; |
|
|
|
return pane; |
|
|
@ -127,24 +133,28 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor |
|
|
|
addButton.setEnabled(size < 2); |
|
|
|
addButton.setEnabled(size < 2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void checkComponent() { |
|
|
|
|
|
|
|
checkAddButton(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void relayoutPane() { |
|
|
|
private void relayoutPane() { |
|
|
|
this.revalidate(); |
|
|
|
this.revalidate(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 给组件登记一个观察者监听事件 |
|
|
|
* 给组件登记一个观察者监听事件 |
|
|
|
* |
|
|
|
* |
|
|
|
* @param listener 观察者监听事件 |
|
|
|
* @param listener 观察者监听事件 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void registerChangeListener(UIObserverListener listener) { |
|
|
|
public void registerChangeListener(UIObserverListener listener) { |
|
|
|
uiobListener = listener; |
|
|
|
uiobListener = listener; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 组件是否需要响应添加的观察者事件 |
|
|
|
* 组件是否需要响应添加的观察者事件 |
|
|
|
* |
|
|
|
* |
|
|
|
* @return 如果需要响应观察者事件则返回true,否则返回false |
|
|
|
* @return 如果需要响应观察者事件则返回true,否则返回false |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean shouldResponseChangeListener() { |
|
|
|
public boolean shouldResponseChangeListener() { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -173,15 +183,20 @@ public class CategoryPlotMoreCateReportDataContentPane extends CategoryPlotRepor |
|
|
|
super.updateBean(collection); |
|
|
|
super.updateBean(collection); |
|
|
|
|
|
|
|
|
|
|
|
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); |
|
|
|
TopDefinitionProvider definition = collection.getSelectedChart().getFilterDefinition(); |
|
|
|
|
|
|
|
Plot plot = collection.getSelectedChart().getPlot(); |
|
|
|
if (definition instanceof NormalReportDataDefinition) { |
|
|
|
if (definition instanceof NormalReportDataDefinition) { |
|
|
|
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; |
|
|
|
NormalReportDataDefinition reportDefinition = (NormalReportDataDefinition) definition; |
|
|
|
|
|
|
|
|
|
|
|
reportDefinition.clearMoreCate(); |
|
|
|
reportDefinition.clearMoreCate(); |
|
|
|
|
|
|
|
updateMoreCate(reportDefinition, plot); |
|
|
|
|
|
|
|
|
|
|
|
for(int i = 0, size = formualList.size(); i < size; i++) { |
|
|
|
} |
|
|
|
TinyFormulaPane pane = formualList.get(i); |
|
|
|
} |
|
|
|
reportDefinition.addMoreCate(canBeFormula(pane.updateBean())); |
|
|
|
|
|
|
|
} |
|
|
|
protected void updateMoreCate(NormalReportDataDefinition reportDefinition, Plot plot) { |
|
|
|
|
|
|
|
for (int i = 0, size = formualList.size(); i < size; i++) { |
|
|
|
|
|
|
|
TinyFormulaPane pane = formualList.get(i); |
|
|
|
|
|
|
|
reportDefinition.addMoreCate(canBeFormula(pane.updateBean())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |