Browse Source

优化接口设计代码

master
mengao 7 years ago
parent
commit
7602e92a1f
  1. 17
      designer/src/com/fr/quickeditor/ChartQuickEditor.java
  2. 2
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java
  3. 4
      designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java
  4. 6
      designer_chart/src/com/fr/design/mainframe/chart/ThirdChartEditPane.java

17
designer/src/com/fr/quickeditor/ChartQuickEditor.java

@ -2,10 +2,8 @@ package com.fr.quickeditor;
import com.fr.base.chart.BaseChartCollection; import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.ThirdChart;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.selection.QuickEditor; import com.fr.design.selection.QuickEditor;
@ -21,7 +19,6 @@ import java.awt.*;
public class ChartQuickEditor extends QuickEditor<TargetComponent>{ public class ChartQuickEditor extends QuickEditor<TargetComponent>{
// kunsnat: editingPropertyPane初始化 避开设计器启动, 在用到的时候再初始化. // kunsnat: editingPropertyPane初始化 避开设计器启动, 在用到的时候再初始化.
//private BaseChartPropertyPane editingPropertyPane = null; //private BaseChartPropertyPane editingPropertyPane = null;
private static boolean lastChartType =false;
public ChartQuickEditor() { public ChartQuickEditor() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
setBorder(null); setBorder(null);
@ -48,20 +45,10 @@ public class ChartQuickEditor extends QuickEditor<TargetComponent>{
element = ((ElementCasePane)tc).getEditingElementCase().getFloatElement(fs.getSelectedFloatName()); element = ((ElementCasePane)tc).getEditingElementCase().getFloatElement(fs.getSelectedFloatName());
} }
collection = (BaseChartCollection) element.getValue(); collection = (BaseChartCollection) element.getValue();
boolean chartType = false; String plotID=((ChartCollection)collection).getSelectedChart().getPlot().getPlotID();
if (((ChartCollection) collection).getSelectedChart() instanceof ThirdChart) {
chartType = true;
}
if (chartType != lastChartType) {
ChartPropertyPane.clear();
}
add(editingPropertyPane = DesignModuleFactory.getChartPropertyPane(), BorderLayout.CENTER); add(editingPropertyPane = DesignModuleFactory.getChartPropertyPane(), BorderLayout.CENTER);
editingPropertyPane.addChartEditPane(((ChartCollection)collection).getSelectedChart().getPlot().getPlotID()); editingPropertyPane.addChartEditPane(plotID);
editingPropertyPane.setSupportCellData(true); editingPropertyPane.setSupportCellData(true);
if (((ChartCollection) collection).getSelectedChart() instanceof ThirdChart) {
lastChartType = true;
}
} }
editingPropertyPane.populateChartPropertyPane(collection, tc); editingPropertyPane.populateChartPropertyPane(collection, tc);
} }

2
designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java

@ -32,6 +32,7 @@ public abstract class AbstractIndependentChartUI implements IndependentChartUIPr
public ChartDataPane getChartDataPane(AttributeChangeListener listener){ public ChartDataPane getChartDataPane(AttributeChangeListener listener){
return new ChartDataPane(listener); return new ChartDataPane(listener);
} }
/** /**
* 是否使用默认的界面为了避免界面来回切换 * 是否使用默认的界面为了避免界面来回切换
* @return 是否使用默认的界面 * @return 是否使用默认的界面
@ -55,6 +56,7 @@ public abstract class AbstractIndependentChartUI implements IndependentChartUIPr
public ConditionAttributesPane getPlotConditionPane(Plot plot){ public ConditionAttributesPane getPlotConditionPane(Plot plot){
return new DataSeriesConditionPane(); return new DataSeriesConditionPane();
} }
public ChartEditPane getChartConfigPane(String plotID){ return StableUtils.construct(ChartEditPane.class);} public ChartEditPane getChartConfigPane(String plotID){ return StableUtils.construct(ChartEditPane.class);}
} }

4
designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java

@ -14,9 +14,7 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{
* 创建图表属性表实例. * 创建图表属性表实例.
*/ */
private synchronized static ChartPropertyPane getInstance() { private synchronized static ChartPropertyPane getInstance() {
if(singleton == null) { singleton = new ChartPropertyPane();
singleton = new ChartPropertyPane();
}
return singleton; return singleton;
} }

6
designer_chart/src/com/fr/design/mainframe/chart/ThirdChartEditPane.java

@ -39,7 +39,7 @@ public abstract class ThirdChartEditPane extends ChartEditPane implements ChartE
}; };
/** /**
* 重新构造面板 * 重新构造面板
* @param currentChart 图表 * @param currentChart 图表
*/ */
public void reLayout(Chart currentChart){ public void reLayout(Chart currentChart){
@ -72,6 +72,7 @@ public abstract class ThirdChartEditPane extends ChartEditPane implements ChartE
int index = Math.min(tabsHeaderIconPane.getSelectedIndex(), paneList.size() - 1); int index = Math.min(tabsHeaderIconPane.getSelectedIndex(), paneList.size() - 1);
return paneList.get(index).title4PopupWindow(); return paneList.get(index).title4PopupWindow();
} }
/** /**
* 设置容器. * 设置容器.
*/ */
@ -104,7 +105,6 @@ public abstract class ThirdChartEditPane extends ChartEditPane implements ChartE
//populate的时候看看要不要重构面板 //populate的时候看看要不要重构面板
private boolean checkNeedsReLayout(Chart chart){ private boolean checkNeedsReLayout(Chart chart){
return false; return false;
} }
@ -162,7 +162,7 @@ public abstract class ThirdChartEditPane extends ChartEditPane implements ChartE
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return null; return "CustomChart";
} }
} }

Loading…
Cancel
Save