Browse Source

update

master
Fangjie Hu 8 years ago
parent
commit
a519db2b8b
  1. 48
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

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

@ -38,9 +38,31 @@ public class ChartTypePane extends AbstractChartAttrPane{
private ChartTypeButtonPane buttonPane; private ChartTypeButtonPane buttonPane;
private ChartEditPane editPane; private ChartEditPane editPane;
private ChartCollection editingCollection; private ChartCollection editingCollection;
//记录面板所处状态 private PaneState paneState = new PaneState();
private SwitchState paneState = SwitchState.DEFAULT;
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 @Override
protected JPanel createContentPane() { protected JPanel createContentPane() {
JPanel content = new JPanel(new BorderLayout()); JPanel content = new JPanel(new BorderLayout());
@ -179,6 +201,13 @@ public class ChartTypePane extends AbstractChartAttrPane{
String plotID = chart.getPlot().getPlotID(); String plotID = chart.getPlot().getPlotID();
Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID); Object item = ChartTypeInterfaceManager.getInstance().getTitle4PopupWindow(chartID, plotID);
jcb.setSelectedItem(item); jcb.setSelectedItem(item);
//重新选中
checkPlotPane();
}
private void checkPlotPane() {
CardLayout cl = (CardLayout)cardPane.getLayout();
cl.show(cardPane, cardNames[jcb.getSelectedIndex()]);
} }
private void reactorComboBox() { private void reactorComboBox() {
@ -228,13 +257,22 @@ public class ChartTypePane extends AbstractChartAttrPane{
public void reactorChartTypePane(ChartCollection collection){ public void reactorChartTypePane(ChartCollection collection){
if (paneState != collection.getState()) { if (needReactor(collection)) {
chartTypePane.reactor(collection); chartTypePane.reactor(collection);
//设置面板切换状态 //设置面板切换状态
paneState = collection.getState(); 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();
}
/** /**
* 更新界面属性 用于展示 * 更新界面属性 用于展示
*/ */

Loading…
Cancel
Save