zheng
5 years ago
8 changed files with 304 additions and 65 deletions
@ -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; |
||||
} |
||||
|
||||
} |
@ -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()); |
||||
} |
||||
} |
@ -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()); |
||||
} |
||||
} |
@ -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()); |
||||
} |
||||
} |
@ -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); |
||||
} |
||||
} |
@ -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…
Reference in new issue