Browse Source

切换面板重构

master
Fangjie Hu 8 years ago
parent
commit
985546787d
  1. 18
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypeButtonPane.java
  2. 13
      designer_chart/src/com/fr/design/mainframe/chart/gui/ChartTypePane.java

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

@ -19,6 +19,7 @@ import com.fr.design.mainframe.chart.gui.ChartTypePane.ComboBoxPane;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.FRLogger; import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -51,6 +52,7 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
private UITextField currentEditingEditor = null; private UITextField currentEditingEditor = null;
private ChartTypePane parent = null; private ChartTypePane parent = null;
private String lastPlotID = StringUtils.EMPTY;
//记录鼠标当前是否在操作添加按钮 //记录鼠标当前是否在操作添加按钮
private boolean mouseOnChartTypeButtonPane = false; private boolean mouseOnChartTypeButtonPane = false;
@ -281,16 +283,18 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
return Inter.getLocText("FR-Chart-Types_Switch"); return Inter.getLocText("FR-Chart-Types_Switch");
} }
/**
* 返回是否还需要更新
* @param name
* @return
*/
private void changeCollectionSelected(String name) { private void changeCollectionSelected(String name) {
if (editingCollection != null) { if (editingCollection != null) {
lastPlotID = editingCollection.getSelectedChart().getPlot().getPlotID();
int count = editingCollection.getChartCount(); int count = editingCollection.getChartCount();
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
if (ComparatorUtils.equals(name, editingCollection.getChartName(i))) { if (ComparatorUtils.equals(name, editingCollection.getChartName(i))) {
editingCollection.setSelectedIndex(i); editingCollection.setSelectedIndex(i);
//重构面板
if (parent != null){
parent.reLayoutEditPane(editingCollection.getSelectedChart());
}
break; break;
} }
} }
@ -509,6 +513,12 @@ public class ChartTypeButtonPane extends BasicBeanPane<ChartCollection> implemen
changeCollectionSelected(getButtonName()); changeCollectionSelected(getButtonName());
setSelectedWithFireListener(true); setSelectedWithFireListener(true);
fireSelectedChanged(); fireSelectedChanged();
//需要先更新,最后重构面板
//重构面板
if (parent != null ){
parent.reLayoutEditPane(lastPlotID, editingCollection);
}
} }
} }

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

@ -262,12 +262,17 @@ public class ChartTypePane extends AbstractChartAttrPane{
} }
/** /**
* 重构面板 * 面板重构
* @param chart * @param lastPlotID
* @param collection
*/ */
public void reLayoutEditPane(Chart chart){ public void reLayoutEditPane(String lastPlotID, ChartCollection collection){
if (editPane != null){ Chart chart = collection.getSelectedChart();
String plotID = chart.getPlot().getPlotID();
boolean isUseDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
if (editPane != null && editPane.isDefaultPane() != isUseDefault || (!isUseDefault && !ComparatorUtils.equals(lastPlotID, plotID))){
editPane.reLayout(chart); editPane.reLayout(chart);
} }
} }

Loading…
Cancel
Save