Browse Source

接口抽象类

persist/11.0
zheng 5 years ago
parent
commit
4831883915
  1. 84
      designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java
  2. 30
      designer-chart/src/main/java/com/fr/design/chartx/AbstractVanSingleDataPane.java
  3. 25
      designer-chart/src/main/java/com/fr/design/chartx/GanttChartDataPane.java
  4. 21
      designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java
  5. 20
      designer-chart/src/main/java/com/fr/design/chartx/WordCloudChartDataPane.java
  6. 68
      designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java
  7. 42
      designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractOtherPane.java
  8. 79
      designer-chart/src/main/java/com/fr/design/chartx/impl/CommonTypePane.java

84
designer-chart/src/main/java/com/fr/design/chart/fun/impl/AbstractChartTypeUI.java

@ -0,0 +1,84 @@
package com.fr.design.chart.fun.impl;
import com.fr.chart.chartattr.Plot;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.chart.fun.ChartTypeUIProvider;
import com.fr.design.chartx.impl.AbstractDataPane;
import com.fr.design.chartx.impl.AbstractOtherPane;
import com.fr.design.condition.ConditionAttributesPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.ChartEditPane;
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.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.stable.fun.impl.AbstractProvider;
/**
* Created by shine on 2019/09/03.
*/
public abstract class AbstractChartTypeUI extends AbstractProvider implements ChartTypeUIProvider {
@Override
public abstract AbstractDataPane getChartDataPane(AttributeChangeListener listener);
@Override
public abstract AbstractOtherPane[] getAttrPaneArray(AttributeChangeListener listener);
@Override
public String[] getSubName() {
return new String[]{getName()};
}
@Override
public boolean needChartChangePane() {
return false;
}
@Override
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) {
return null;
}
@Override
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) {
return null;
}
@Override
public boolean isUseDefaultPane() {
return false;
}
@Override
public int currentAPILevel() {
return CURRENT_API_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
@Override
public ChartEditPane getChartEditPane(String plotID) {
return new ChartEditPane();
}
@Override
public ConditionAttributesPane getPlotConditionPane(Plot plot) {
return null;
}
@Override
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot) {
return null;
}
@Override
public ChartsConfigPane getChartConfigPane(String plotID) {
return null;
}
}

30
designer-chart/src/main/java/com/fr/design/chartx/MultiCategoryChartDataPane.java → designer-chart/src/main/java/com/fr/design/chartx/AbstractVanSingleDataPane.java

@ -1,24 +1,30 @@
package com.fr.design.chartx;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane;
import com.fr.design.chartx.fields.diff.MultiCategoryDataSetFieldsPane;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import javax.swing.JPanel;
/**
* Created by shine on 2019/5/22.
* Created by shine on 2019/09/06.
*/
public class MultiCategoryChartDataPane extends AbstractChartDataPane<AbstractDataDefinition> {
public abstract class AbstractVanSingleDataPane extends AbstractChartDataPane<AbstractDataDefinition> {
private SingleDataPane singleDataPane;
public MultiCategoryChartDataPane(AttributeChangeListener listener) {
public AbstractVanSingleDataPane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected JPanel createContentPane() {
singleDataPane = createSingleDataPane();
return singleDataPane;
}
protected abstract SingleDataPane createSingleDataPane();
@Override
protected void populate(AbstractDataDefinition dataDefinition) {
singleDataPane.populateBean(dataDefinition);
@ -28,16 +34,4 @@ public class MultiCategoryChartDataPane extends AbstractChartDataPane<AbstractDa
protected AbstractDataDefinition update() {
return singleDataPane.updateBean();
}
@Override
protected JPanel createContentPane() {
singleDataPane = createSingleDataPane();
return singleDataPane;
}
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane());
}
}

25
designer-chart/src/main/java/com/fr/design/chartx/GanttChartDataPane.java

@ -1,6 +1,9 @@
package com.fr.design.chartx;
import com.fr.chartx.data.GanttChartDataDefinition;
import com.fr.design.chartx.fields.diff.MultiCategoryCellDataFieldsPane;
import com.fr.design.chartx.fields.diff.MultiCategoryDataSetFieldsPane;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.van.chart.map.designer.VanChartGroupPane;
@ -11,13 +14,23 @@ import javax.swing.JPanel;
*/
public class GanttChartDataPane extends AbstractChartDataPane<GanttChartDataDefinition> {
private MultiCategoryChartDataPane dataPane;
private MultiCategoryChartDataPane linkPane;
private AbstractVanSingleDataPane dataPane;
private AbstractVanSingleDataPane linkPane;
@Override
protected JPanel createContentPane() {
dataPane = new MultiCategoryChartDataPane(listener);
linkPane = new MultiCategoryChartDataPane(listener);
dataPane = new AbstractVanSingleDataPane(listener) {
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane());
}
};
linkPane = new AbstractVanSingleDataPane(listener) {
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiCategoryDataSetFieldsPane(), new MultiCategoryCellDataFieldsPane());
}
};
return new VanChartGroupPane(new String[]{"data", "link"}, new JPanel[]{dataPane, linkPane}) {
};
}
@ -27,13 +40,13 @@ public class GanttChartDataPane extends AbstractChartDataPane<GanttChartDataDefi
}
@Override
protected void populate(GanttChartDataDefinition ganttChartDataDefinition) {
public void populate(GanttChartDataDefinition ganttChartDataDefinition) {
dataPane.populate(ganttChartDataDefinition.getDataDefinition());
linkPane.populate(ganttChartDataDefinition.getLinkDefinition());
}
@Override
protected GanttChartDataDefinition update() {
public GanttChartDataDefinition update() {
return null;
}
}

21
designer-chart/src/main/java/com/fr/design/chartx/MultiPieChartDataPane.java

@ -1,21 +0,0 @@
package com.fr.design.chartx;
import com.fr.design.chartx.fields.diff.MultiPieCellDataFieldsPane;
import com.fr.design.chartx.fields.diff.MultiPieDataSetFieldsPane;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
/**
* Created by shine on 2019/6/18.
*/
public class MultiPieChartDataPane extends MultiCategoryChartDataPane {
public MultiPieChartDataPane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new MultiPieDataSetFieldsPane(), new MultiPieCellDataFieldsPane());
}
}

20
designer-chart/src/main/java/com/fr/design/chartx/WordCloudChartDataPane.java

@ -1,20 +0,0 @@
package com.fr.design.chartx;
import com.fr.design.chartx.fields.diff.WordCloudCellDataFieldsPane;
import com.fr.design.chartx.fields.diff.WordCloudDataSetFieldsPane;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
/**
* Created by shine on 2019/5/22.
*/
public class WordCloudChartDataPane extends MultiCategoryChartDataPane {
public WordCloudChartDataPane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new WordCloudDataSetFieldsPane(), new WordCloudCellDataFieldsPane());
}
}

68
designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractDataPane.java

@ -0,0 +1,68 @@
package com.fr.design.chartx.impl;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.impl.AbstractChartWithData;
import com.fr.chartx.data.AbstractDataDefinition;
import com.fr.chartx.data.ChartDataDefinitionProvider;
import com.fr.design.chartx.single.SingleDataPane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.mainframe.chart.gui.ChartDataPane;
import com.fr.plugin.chart.vanchart.VanChart;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Created by shine on 2019/09/04.
*/
public abstract class AbstractDataPane extends ChartDataPane {
private SingleDataPane singleDataPane;
public AbstractDataPane(AttributeChangeListener listener) {
super(listener);
}
@Override
protected JPanel createContentPane() {
singleDataPane = createSingleDataPane();
return singleDataPane;
}
protected abstract SingleDataPane createSingleDataPane();
@Override
public void populate(ChartCollection collection) {
if (collection == null) {
return;
}
AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class);
if (chart == null) {
return;
}
this.removeAll();
this.add(createContentPane(), BorderLayout.CENTER);
ChartDataDefinitionProvider dataDefinition = chart.getChartDataDefinition();
singleDataPane.populateBean((AbstractDataDefinition) dataDefinition);
this.initAllListeners();
this.validate();
}
@Override
public void update(ChartCollection collection) {
if (collection == null) {
return;
}
VanChart chart = collection.getSelectedChart(VanChart.class);
if (chart == null) {
return;
}
chart.setChartDataDefinition(singleDataPane.updateBean());
}
}

42
designer-chart/src/main/java/com/fr/design/chartx/impl/AbstractOtherPane.java

@ -0,0 +1,42 @@
package com.fr.design.chartx.impl;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.impl.AbstractChartWithData;
import com.fr.design.mainframe.chart.AbstractChartAttrPane;
/**
* Created by shine on 2019/09/04.
*/
public abstract class AbstractOtherPane<T extends AbstractChartWithData> extends AbstractChartAttrPane {
protected abstract void populate(T chart);
protected abstract void update(T chart);
@Override
public void populate(ChartCollection collection) {
if (collection == null) {
return;
}
AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class);
if (chart == null) {
return;
}
populate((T) chart);
}
@Override
public void update(ChartCollection collection) {
if (collection == null) {
return;
}
AbstractChartWithData chart = collection.getSelectedChart(AbstractChartWithData.class);
if (chart == null) {
return;
}
update((T) chart);
}
}

79
designer-chart/src/main/java/com/fr/design/chartx/impl/CommonTypePane.java

@ -0,0 +1,79 @@
package com.fr.design.chartx.impl;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chart.impl.AbstractChartWithData;
import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane;
import com.fr.design.mainframe.chart.gui.type.ChartImagePane;
/**
* Created by shine on 2019/09/04.
*/
public class CommonTypePane<T extends AbstractChartWithData> extends AbstractChartTypePane<AbstractChartWithData> {
@Override
protected String[] getTypeIconPath() {
return new String[0];
}
@Override
protected String[] getTypeTipName() {
return ChartTypeInterfaceManager.getInstance().getSubName(getPlotID());
}
@Override
public ChartProvider getDefaultChart() {
return ChartTypeManager.getInstance().getChartTypes(getPlotID())[0];
}
@Override
public String title4PopupWindow() {
return ChartTypeInterfaceManager.getInstance().getName(getPlotID());
}
protected int getSelectIndexInChart(T chart) {
return 0;
}
protected void setSelectIndexInChart(T chart, int index) {
}
@Override
public void populateBean(AbstractChartWithData ob) {
if (getTypeIconPath().length > 0) {
for (ChartImagePane imagePane : typeDemo) {
imagePane.isPressing = false;
}
typeDemo.get(getSelectIndexInChart((T) ob)).isPressing = true;
checkDemosBackground();
}
}
@Override
public void updateBean(AbstractChartWithData ob) {
if (getTypeIconPath().length > 0) {
for (int index = 0, len = typeDemo.size(); index < len; index++) {
if (typeDemo.get(index).isPressing) {
setSelectIndexInChart((T) ob, index);
return;
}
}
}
}
@Override
protected String[] getTypeLayoutPath() {
return new String[0];
}
@Override
protected String[] getTypeLayoutTipName() {
return new String[0];
}
@Override
protected String getPlotTypeID() {
return null;
}
}
Loading…
Cancel
Save