diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 1909c947c..6b280b398 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/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 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){ diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java index 0fef00f31..f9c6e572c 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java @@ -158,8 +158,8 @@ public class ChartTypeButtonPane extends BasicBeanPane implemen //获取图表收集器的状态 private void checkoutChange(){ - SwitchState state = editingCollection.calculateMultiChartMode(); - if (state.isDynamicState() && parent != null){ + editingCollection.calculateMultiChartMode(); + if (parent != null){ parent.reactorChartTypePane(editingCollection); } //检查是否可以配置切换 diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java index 84cfbd52b..78f3f6271 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java +++ b/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); } /**