Browse Source

Merge pull request #429 in BA/design from ~XIAOHU/design:dev to dev

* commit '16099fd0b7acb231da6daa2df07c465b5e0260cf':
  update
  update
  update
  切换bug
master
superman 8 years ago
parent
commit
78168bc155
  1. 15
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  2. 4
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  3. 65
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

15
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -249,6 +249,21 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
return new String[0];
}
/**
* 获取指定图表的标题
* @param chartID
* @return
*/
public String getTitle4PopupWindow(String chartID, String plotID){
if (chartTypeInterfaces != null && chartTypeInterfaces.containsKey(chartID) && chartTypeInterfaces.get(chartID).containsKey(plotID)){
HashMap<String, IndependentChartUIProvider> chartUIList = chartTypeInterfaces.get(chartID);
IndependentChartUIProvider provider = chartTypeInterfaces.get(chartID).get(plotID);
return provider.getPlotTypePane().title4PopupWindow();
}
return new String();
}
private String[] getTitle4PopupWindow(){
int size = 0;
if (chartTypeInterfaces != null){

4
designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java

@ -158,8 +158,8 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
//获取图表收集器的状态
private void checkoutChange(){
SwitchState state = editingCollection.calculateMultiChartMode();
if (state.isDynamicState() && parent != null){
editingCollection.calculateMultiChartMode();
if (parent != null){
parent.reactorChartTypePane(editingCollection);
}
//检查是否可以配置切换

65
designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

@ -8,6 +8,7 @@ import com.fr.chart.chartattr.SwitchState;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.chart.fun.IndependentChartUIProvider;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.icombobox.UIComboBox;
@ -37,7 +38,31 @@ public class ChartTypePane extends AbstractChartAttrPane{
private ChartTypeButtonPane buttonPane;
private ChartEditPane editPane;
private ChartCollection editingCollection;
private PaneState paneState = new PaneState();
private class PaneState{
//记录面板所处状态
private SwitchState paneState = SwitchState.DEFAULT;
//记录当前面板是谁在使用切换状态
private String chartID = StringUtils.EMPTY;
public SwitchState getPaneState() {
return paneState;
}
public void setPaneState(SwitchState paneState) {
this.paneState = paneState;
}
public String getChartID() {
return chartID;
}
public void setChartID(String chartID) {
this.chartID = chartID;
}
}
@Override
protected JPanel createContentPane() {
JPanel content = new JPanel(new BorderLayout());
@ -161,8 +186,6 @@ public class ChartTypePane extends AbstractChartAttrPane{
}
public void reactor(ChartCollection collection){
//重构前存储所选择的下拉选项
Object item = jcb.getSelectedItem();
//重构需要重构下拉框选项和cardNames
Chart chart = collection.getSelectedChart();
String chartID = chart.getChartID();
@ -172,14 +195,28 @@ public class ChartTypePane extends AbstractChartAttrPane{
//第一步就是重构cardNames
cardNames = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID);
//重构下拉框选项
reactorComboBox();
//重新选择选中的下拉项
chartID = chart.getChartID();
String plotID = chart.getPlot().getPlotID();
Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID);
jcb.setSelectedItem(item);
//重新选中
checkPlotPane();
}
private void checkPlotPane() {
CardLayout cl = (CardLayout)cardPane.getLayout();
cl.show(cardPane, cardNames[jcb.getSelectedIndex()]);
}
private void reactorComboBox() {
FlexibleComboBox fcb = (FlexibleComboBox)jcb;
fcb.setItemEvenType(ItemEventType.REACTOR);
fcb.removeAllItems();
for (int i = 0; i < this.cardNames.length; i++) {
fcb.addItem(cardNames[i]);
}
//重新选择选中的下拉项
jcb.setSelectedItem(item);
fcb.setItemEvenType(ItemEventType.DEFAULT);
}
@ -220,7 +257,20 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void reactorChartTypePane(ChartCollection collection){
chartTypePane.reactor(collection);
if (needReactor(collection)) {
chartTypePane.reactor(collection);
//设置面板切换状态
updatePaneState(collection);
}
}
private void updatePaneState(ChartCollection collection) {
paneState.setChartID(collection.getRepresentChartID());
paneState.setPaneState(collection.getState());
}
private boolean needReactor(ChartCollection collection) {
return paneState.getChartID() != collection.getRepresentChartID() || paneState.getPaneState() != collection.getState();
}
/**
@ -228,9 +278,8 @@ public class ChartTypePane extends AbstractChartAttrPane{
*/
public void populate(ChartCollection collection) {
Chart chart = collection.getSelectedChart();
chartTypePane.populateBean(chart);
buttonPane.populateBean(collection);
chartTypePane.populateBean(chart);
}
/**

Loading…
Cancel
Save