Browse Source

继承接口。

master
mengao 8 years ago
parent
commit
e1ecd551b5
  1. 13
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  2. 3
      designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java
  3. 3
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI.java
  4. 9
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI4Custom.java
  5. 3
      designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUIWithAPILevel.java
  6. 20
      designer_chart/src/com/fr/design/mainframe/MiddleChartPropertyPane.java
  7. 44
      designer_chart/src/com/fr/design/mainframe/chart/gui/CustomChartDataPane.java
  8. 157
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/CustomChartDataContentsPane.java

13
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -15,6 +15,7 @@ import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
@ -410,20 +411,20 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
private AbstractTableDataContentPane getTableDataSourcePane(String priority, Plot plot, ChartDataPane parent) {
return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getTableDataSourcePane(plot, parent);
}
public BasicPane getChartConfigPane(Plot plot, ChartDataPane parent) {
public BasicBeanPane getChartConfigPane(String plotID) {
Iterator iterator = chartTypeInterfaces.entrySet().iterator();
while (iterator.hasNext()){
Map.Entry entry = (Map.Entry) iterator.next();
String priority = (String) entry.getKey();
if (plotInChart(plot.getPlotID(), priority)) {
return getChartConfigPane(priority, plot, parent);
if (plotInChart(plotID, priority)) {
return getChartConfigPane(priority, plotID);
}
}
return getChartConfigPane(ChartTypeManager.CHART_PRIORITY, plot, parent);
return getChartConfigPane(ChartTypeManager.CHART_PRIORITY, plotID);
}
private BasicBeanPane getChartConfigPane(String priority, Plot plot, ChartDataPane parent) {
return chartTypeInterfaces.get(priority).get(plot.getPlotID()).getChartConfigPane(plot, parent);
private BasicBeanPane getChartConfigPane(String priority, String plotID) {
return chartTypeInterfaces.get(priority).get(plotID).getChartConfigPane(plotID);
}

3
designer_chart/src/com/fr/design/chart/fun/IndependentChartUIProvider.java

@ -5,6 +5,7 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
@ -89,6 +90,6 @@ public interface IndependentChartUIProvider extends Level {
*/
String getPlotTypeTitle4PopupWindow();
BasicBeanPane getChartConfigPane(Plot plot, ChartDataPane parent);
BasicBeanPane getChartConfigPane(String plotID);
}

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

@ -7,6 +7,7 @@ import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.general.ComparatorUtils;
@ -53,6 +54,6 @@ public abstract class AbstractIndependentChartUI implements IndependentChartUIPr
public ConditionAttributesPane getPlotConditionPane(Plot plot){
return new DataSeriesConditionPane();
}
public BasicBeanPane getChartConfigPane(Plot plot, ChartDataPane parent){ return null;}
public BasicBeanPane getChartConfigPane(String plotID){ return null;}
}

9
designer_chart/src/com/fr/design/chart/fun/impl/AbstractIndependentChartUI4Custom.java

@ -9,9 +9,10 @@ import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.design.mainframe.chart.gui.CustomChartDataPane;
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.gui.type.PiePlotPane;
import com.fr.general.ComparatorUtils;
/**
@ -21,10 +22,14 @@ import com.fr.general.ComparatorUtils;
public abstract class AbstractIndependentChartUI4Custom implements IndependentChartUIProvider {
int CURRENT_API_LEVEL = 3;
@Override
public AbstractChartTypePane getPlotTypePane() {
return new PiePlotPane();
}
@Override
public ChartDataPane getChartDataPane(AttributeChangeListener listener) {
return new CustomChartDataPane(listener);
return new ChartDataPane(listener);
}
@Override

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

@ -7,6 +7,7 @@ import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.design.mainframe.chart.gui.ChartStylePane;
import com.fr.general.ComparatorUtils;
@ -66,5 +67,5 @@ public abstract class AbstractIndependentChartUIWithAPILevel implements Independ
return getPlotTypePane().title4PopupWindow();
}
public BasicBeanPane getChartConfigPane(Plot plot, ChartDataPane parent){ return null;}
public BasicBeanPane getChartConfigPane(String plotID){ return null;}
}

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

@ -11,7 +11,9 @@ import javax.swing.JComponent;
import com.fr.base.BaseUtils;
import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.designer.TargetComponent;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.ChartEditPaneProvider;
import com.fr.design.gui.frpane.UITitlePanel;
@ -27,6 +29,9 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
protected UILabel nameLabel;
protected ChartEditPane chartEditPane;
protected ChartCollection chartCollection;
protected String plotID;
protected BasicPane chartPane;
public MiddleChartPropertyPane() {
initComponenet();
@ -38,7 +43,6 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
createNameLabel();
this.add(createNorthComponent(), BorderLayout.NORTH);
chartEditPane = StableUtils.construct(ChartEditPane.class);
chartEditPane.setSupportCellData(true);
this.createMainPane();
@ -66,7 +70,16 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
protected void resetChartEditPane() {
remove(chartEditPane);
add(chartEditPane, BorderLayout.CENTER);
if (plotID != null) {
chartPane = ChartTypeInterfaceManager.getInstance().getChartConfigPane(plotID);
if (chartPane != null) {
add(chartPane, BorderLayout.CENTER);
}
}
if (chartPane == null) {
chartEditPane = StableUtils.construct(ChartEditPane.class);
add(chartEditPane, BorderLayout.CENTER);
}
validate();
repaint();
revalidate();
@ -97,6 +110,9 @@ public abstract class MiddleChartPropertyPane extends BaseChartPropertyPane{
*/
public void populateChartPropertyPane(BaseChartCollection collection, TargetComponent<?> ePane) {
if (collection instanceof ChartCollection) {
chartCollection = (ChartCollection) collection;
plotID=chartCollection.getSelectedChart().getPlot().getPlotID();
resetChartEditPane();
populateChartPropertyPane((ChartCollection)collection, ePane);
}
}

44
designer_chart/src/com/fr/design/mainframe/chart/gui/CustomChartDataPane.java

@ -1,44 +0,0 @@
package com.fr.design.mainframe.chart.gui;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.data.CustomChartDataContentsPane;
import javax.swing.*;
import java.awt.*;
/**
* Created by mengao on 2017/4/26.
*/
public class CustomChartDataPane extends ChartDataPane {
private boolean supportCellData = true;
public CustomChartDataPane(AttributeChangeListener listener) {
super(listener);
this.listener = listener;
}
@Override
protected JPanel createContentPane() {
contentsPane = new CustomChartDataContentsPane(listener, CustomChartDataPane.this);
return contentsPane;
}
protected void repeatLayout(ChartCollection collection) {
Plot plot =collection.getSelectedChart().getPlot();
if (contentsPane != null) {
this.remove(contentsPane);
}
this.setLayout(new BorderLayout(0, 0));
contentsPane = new CustomChartDataContentsPane(listener, CustomChartDataPane.this ,plot);
if (contentsPane != null) {
contentsPane.setSupportCellData(supportCellData);
}
}
}

157
designer_chart/src/com/fr/design/mainframe/chart/gui/data/CustomChartDataContentsPane.java

@ -1,157 +0,0 @@
package com.fr.design.mainframe.chart.gui.data;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.Plot;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.dialog.BasicScrollPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
/**
* Created by mengao on 2017/4/26.
*/
public class CustomChartDataContentsPane extends DataContentsPane {
public UIComboBoxPane<ChartCollection> dataPane;
private TableDataPane tableDataPane;
private ReportDataPane reportDataPane;
private BasicBeanPane configPane;
private AttributeChangeListener listener;
private Plot plot;
private ChartDataPane parent;
public CustomChartDataContentsPane(AttributeChangeListener listener, ChartDataPane parent) {
this.listener = listener;
this.parent = parent;
initAll();
}
public CustomChartDataContentsPane(AttributeChangeListener listener, ChartDataPane parent, boolean supportCellData) {
this.listener = listener;
this.parent = parent;
initAll();
dataPane.justSupportOneSelect(true);
}
public CustomChartDataContentsPane(AttributeChangeListener listener, ChartDataPane parent, Plot plot) {
this.listener = listener;
this.parent = parent;
this.plot= plot;
initAll();
}
public CustomChartDataContentsPane(AttributeChangeListener listener, ChartDataPane parent, boolean supportCellData, Plot plot) {
this.listener = listener;
this.parent = parent;
this.plot= plot;
initAll();
dataPane.justSupportOneSelect(true);
}
public UIComboBoxPane<ChartCollection> getDataPane() {
return dataPane;
}
@Override
protected JPanel createContentPane() {
return new BasicScrollPane<ChartCollection>() {
@Override
protected JPanel createContentPane() {
JPanel contentPane = new JPanel(new BorderLayout());
dataPane = new UIComboBoxPane<ChartCollection>() {
protected void initLayout() {
this.setLayout(new BorderLayout(LayoutConstants.HGAP_LARGE, 6));
JPanel northPane = new JPanel(new BorderLayout(LayoutConstants.HGAP_LARGE, 0));
JButton jButton = new JButton();
if(plot!=null){
configPane = (BasicBeanPane)ChartTypeInterfaceManager.getInstance().getChartConfigPane(plot, parent);
northPane.add(configPane, BorderLayout.CENTER);
}else {
northPane.add(jButton, BorderLayout.CENTER);
}
this.add(northPane, BorderLayout.NORTH);
}
@Override
protected String title4PopupWindow() {
return null;
}
@Override
protected java.util.List<FurtherBasicBeanPane<? extends ChartCollection>> initPaneList() {
tableDataPane = getTableDataPane(parent);
reportDataPane = getReportDataPane(parent);
java.util.List<FurtherBasicBeanPane<? extends ChartCollection>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartCollection>>();
paneList.add(tableDataPane);
paneList.add(reportDataPane);
return paneList;
}
};
contentPane.add(dataPane, BorderLayout.CENTER);
dataPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
return contentPane;
}
@Override
protected String title4PopupWindow() {
return "";
}
@Override
public void populateBean(ChartCollection ob) {
}
};
}
protected ReportDataPane getReportDataPane(ChartDataPane parent) {
return new ReportDataPane(parent);
}
protected TableDataPane getTableDataPane(ChartDataPane chartDataPane) {
return new TableDataPane(chartDataPane);
}
/**
* 更新界面 数据内容
*/
public void populate(ChartCollection collection) {
Plot plot = collection.getSelectedChart().getPlot();
dataPane.populateBean(collection);
configPane.populateBean(plot);
}
/**
* 保存 数据界面内容
*/
public void update(ChartCollection collection) {
Plot plot = collection.getSelectedChart().getPlot();
configPane.updateBean(plot);
dataPane.updateBean(collection);
configPane.updateBean();
}
/**
* 是否支持单元格数据
*/
public void setSupportCellData(boolean supportCellData) {
dataPane.justSupportOneSelect(supportCellData);
}
}
Loading…
Cancel
Save