Browse Source

修改一直触发查询bug,整理chartEditPane加载代码。

master
mengao 7 years ago
parent
commit
4124ad704b
  1. 3
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java
  2. 3
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java
  3. 2
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartsUI.java
  4. 6
      designer_chart/src/com/fr/design/mainframe/ChartPropertyPane.java
  5. 6
      designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java
  6. 71
      designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java
  7. 9
      designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java

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

@ -12,7 +12,6 @@ import com.fr.design.mainframe.chart.ChartsConfigPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils;
/**
@ -58,7 +57,7 @@ public abstract class AbstractIndependentChartUI implements IndependentChartUIPr
return new DataSeriesConditionPane();
}
public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);}
public ChartEditPane getChartEditPane(String plotID){ return ChartEditPane.getInstance();}
public ChartsConfigPane getChartConfigPane(String plotID){return null;}

3
designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java

@ -12,7 +12,6 @@ import com.fr.design.mainframe.chart.ChartsConfigPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.general.ComparatorUtils;
import com.fr.stable.StableUtils;
/**
* Created by Mitisky on 16/3/7.
@ -69,7 +68,7 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ
return getPlotTypePane().title4PopupWindow();
}
public ChartEditPane getChartEditPane(String plotID){ return StableUtils.construct(ChartEditPane.class);}
public ChartEditPane getChartEditPane(String plotID){ return ChartEditPane.getInstance();}
public ChartsConfigPane getChartConfigPane(String plotID){return null;}
}

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

@ -97,7 +97,7 @@ public abstract class AbstractIndependentChartsUI extends AbstractProvider imple
@Override
public ChartEditPane getChartEditPane(String plotID) {
return new ChartsEditPane();
return ChartsEditPane.getInstance();
}
}

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

@ -14,9 +14,10 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{
* 创建图表属性表实例.
*/
private synchronized static ChartPropertyPane getInstance() {
//todo
//创建新图表时,创建属性表配置面板
if (singleton == null) {
singleton = new ChartPropertyPane();
}
return singleton;
}
@ -36,6 +37,9 @@ public class ChartPropertyPane extends MiddleChartPropertyPane{
@Override
protected void createMainPane() {
this.removeAll();
createNameLabel();
this.add(createNorthComponent(), BorderLayout.NORTH);
this.add(chartEditPane, BorderLayout.CENTER);
}

6
designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java

@ -15,7 +15,6 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itabpane.TitleChangeListener;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.general.Inter;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
@ -34,10 +33,7 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
protected void initComponenet() {
this.setLayout(new BorderLayout());
this.setBorder(null);
createNameLabel();
this.add(createNorthComponent(), BorderLayout.NORTH);
chartEditPane = StableUtils.construct(ChartEditPane.class);
chartEditPane = ChartEditPane.getInstance();
chartEditPane.setSupportCellData(true);
}

71
designer_chart/src/com/fr/design/mainframe/chart/ChartEditPane.java

@ -6,6 +6,8 @@ import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.tabledata.Prepare4DataSourceChange;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.chart.ChartEditPaneProvider;
import com.fr.design.gui.frpane.AttributeChangeListener;
@ -22,12 +24,23 @@ import com.fr.general.FRLogger;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class ChartEditPane extends BasicPane implements AttributeChange, ChartEditPaneProvider {
public class ChartEditPane extends BasicPane implements AttributeChange,Prepare4DataSourceChange, ChartEditPaneProvider {
public synchronized static ChartEditPane getInstance() {
if (singleton == null) {
singleton = new ChartEditPane();
}
return singleton;
}
private static ChartEditPane singleton;
private final static int CHANGE_MIN_TIME = 80;
@ -65,9 +78,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd
paneList.add(otherPane);
createTabsPane();
//TableDataComboBox 中有注册DSChangeListener,这里没有必要再次注册。
//registerDSChangeListener();
registerDSChangeListener();
}
//构建主面板
@ -117,7 +128,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd
} catch (CloneNotSupportedException e) {
FRLogger.getLogger().error("error in clone ChartEditPane");
}
if (ComparatorUtils.equals(selectedPane.title4PopupWindow(), PaneTitleConstants.CHART_STYLE_TITLE)) {
if(ComparatorUtils.equals(selectedPane.title4PopupWindow(),PaneTitleConstants.CHART_STYLE_TITLE)){
dealWithStyleChange();
}
@ -128,11 +139,10 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd
/**
* 重新构造面板
*
* @param currentChart 图表
*/
public void reLayout(Chart currentChart) {
if (currentChart != null) {
public void reLayout(Chart currentChart){
if(currentChart != null){
int chartIndex = getSelectedChartIndex(currentChart);
this.removeAll();
this.setLayout(new BorderLayout());
@ -141,21 +151,21 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd
boolean isDefault = true;
String plotID = "";
if (currentChart.getPlot() != null) {
if(currentChart.getPlot() != null){
plotID = currentChart.getPlot().getPlotID();
isDefault = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
}
if (isDefault) {
if(isDefault){
paneList.add(dataPane4SupportCell);
paneList.add(stylePane);
paneList.add(otherPane);
this.isDefaultPane = true;
} else {
}else{
ChartDataPane chartDataPane = createChartDataPane(plotID);
paneList.add(chartDataPane);
AbstractChartAttrPane[] otherPaneList = ChartTypeInterfaceManager.getInstance().getAttrPaneArray(plotID, listener);
for (int i = 0; i < otherPaneList.length; i++) {
for(int i = 0; i < otherPaneList.length; i++){
otherPaneList[i].addAttributeChangeListener(listener);
paneList.add(otherPaneList[i]);
}
@ -222,7 +232,7 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd
return;
}
if (checkNeedsReLayout(collection.getSelectedChart())) {
if(checkNeedsReLayout(collection.getSelectedChart())){
reLayout(collection.getSelectedChart());
}
@ -249,12 +259,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd
}
}
public int getSelectedChartIndex(Chart chart) {
public int getSelectedChartIndex(Chart chart){
int index = 0;
if (typePane != null) {
if(typePane != null){
FurtherBasicBeanPane[] paneList = typePane.getPaneList();
for (; index < paneList.length; index++) {
if (paneList[index].accept(chart)) {
for(; index < paneList.length; index++){
if(paneList[index].accept(chart)){
return index;
}
}
@ -263,12 +273,12 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd
}
//populate的时候看看要不要重构面板
private boolean checkNeedsReLayout(Chart chart) {
if (chart != null) {
private boolean checkNeedsReLayout(Chart chart){
if(chart != null){
int lastIndex = typePane.getSelectedIndex();
int currentIndex = getSelectedChartIndex(chart);
boolean currentPane = true;
if (chart.getPlot() != null) {
if(chart.getPlot() != null){
String plotID = chart.getPlot().getPlotID();
currentPane = ChartTypeInterfaceManager.getInstance().isUseDefaultPane(plotID);
}
@ -279,10 +289,9 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd
/**
* 当前界面是否是默认的界面
*
* @return 是否是默认的界面
*/
public boolean isDefaultPane() {
public boolean isDefaultPane(){
return this.isDefaultPane;
}
@ -314,16 +323,15 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd
}
}
protected void dealWithStyleChange() {
protected void dealWithStyleChange(){
}
/**
* 主要用于图表设计器判断样式改变是否来自工具栏的全局样式按钮
*
*主要用于图表设计器判断样式改变是否来自工具栏的全局样式按钮
* @param isFromToolBar 是否来自工具栏
*/
public void styleChange(boolean isFromToolBar) {
public void styleChange(boolean isFromToolBar){
}
@ -336,4 +344,15 @@ public class ChartEditPane extends BasicPane implements AttributeChange, ChartEd
paneList.get(index).addAttributeChangeListener(listener);
}
/**
* 数据集改变的事件监听
*/
public void registerDSChangeListener() {
DesignTableDataManager.addDsChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
AbstractChartAttrPane attrPane = paneList.get(tabsHeaderIconPane.getSelectedIndex());
attrPane.refreshChartDataPane(collection);
}
});
}
}

9
designer_chart/src/com/fr/design/mainframe/chart/ChartsEditPane.java

@ -13,6 +13,15 @@ import java.util.ArrayList;
public class ChartsEditPane extends ChartEditPane {
protected ChartsConfigPane chartsConfigPane;
private static ChartEditPane single;
public synchronized static ChartEditPane getInstance() {
if (single == null) {
single = new ChartsEditPane();
}
return single;
}
public ChartsEditPane() {
this.setLayout(new BorderLayout());

Loading…
Cancel
Save