|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.fr.van.chart.designer.type; |
|
|
|
package com.fr.van.chart.designer.type; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.fr.base.BaseUtils; |
|
|
|
import com.fr.chart.base.AttrFillStyle; |
|
|
|
import com.fr.chart.base.AttrFillStyle; |
|
|
|
import com.fr.chart.chartattr.Chart; |
|
|
|
import com.fr.chart.chartattr.Chart; |
|
|
|
import com.fr.chart.chartattr.Legend; |
|
|
|
import com.fr.chart.chartattr.Legend; |
|
|
@ -7,13 +8,16 @@ import com.fr.chart.chartattr.Plot; |
|
|
|
import com.fr.chart.chartglyph.ConditionAttr; |
|
|
|
import com.fr.chart.chartglyph.ConditionAttr; |
|
|
|
import com.fr.chart.chartglyph.ConditionCollection; |
|
|
|
import com.fr.chart.chartglyph.ConditionCollection; |
|
|
|
import com.fr.chart.chartglyph.DataSheet; |
|
|
|
import com.fr.chart.chartglyph.DataSheet; |
|
|
|
|
|
|
|
import com.fr.chart.charttypes.ChartTypeManager; |
|
|
|
import com.fr.chartx.data.AbstractDataDefinition; |
|
|
|
import com.fr.chartx.data.AbstractDataDefinition; |
|
|
|
import com.fr.chartx.data.ChartDataDefinitionProvider; |
|
|
|
import com.fr.chartx.data.ChartDataDefinitionProvider; |
|
|
|
import com.fr.chartx.data.field.AbstractColumnFieldCollection; |
|
|
|
import com.fr.chartx.data.field.AbstractColumnFieldCollection; |
|
|
|
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; |
|
|
|
import com.fr.chartx.data.field.diff.MultiCategoryColumnFieldCollection; |
|
|
|
import com.fr.design.ChartTypeInterfaceManager; |
|
|
|
import com.fr.design.ChartTypeInterfaceManager; |
|
|
|
|
|
|
|
import com.fr.design.gui.ibutton.UIButton; |
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
import com.fr.design.gui.icheckbox.UICheckBox; |
|
|
|
import com.fr.design.gui.ilable.MultilineLabel; |
|
|
|
import com.fr.design.gui.ilable.MultilineLabel; |
|
|
|
|
|
|
|
import com.fr.design.i18n.Toolkit; |
|
|
|
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
|
|
|
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
|
|
|
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; |
|
|
|
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; |
|
|
|
import com.fr.design.mainframe.chart.info.ChartInfoCollector; |
|
|
|
import com.fr.design.mainframe.chart.info.ChartInfoCollector; |
|
|
@ -25,21 +29,53 @@ import com.fr.plugin.chart.base.VanChartTools; |
|
|
|
import com.fr.plugin.chart.base.VanChartZoom; |
|
|
|
import com.fr.plugin.chart.base.VanChartZoom; |
|
|
|
import com.fr.plugin.chart.vanchart.VanChart; |
|
|
|
import com.fr.plugin.chart.vanchart.VanChart; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.BorderLayout; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Component; |
|
|
|
import java.awt.Component; |
|
|
|
|
|
|
|
import java.awt.Dimension; |
|
|
|
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
|
|
|
|
public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Chart> { |
|
|
|
public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Chart> { |
|
|
|
private static final long serialVersionUID = 7743244512351499265L; |
|
|
|
private static final long serialVersionUID = 7743244512351499265L; |
|
|
|
private UICheckBox largeModelCheckBox; |
|
|
|
private UICheckBox largeModelCheckBox; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected JPanel buttonPane; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected UIButton autoButton; |
|
|
|
|
|
|
|
|
|
|
|
private boolean samePlot; |
|
|
|
private boolean samePlot; |
|
|
|
|
|
|
|
|
|
|
|
protected boolean isSamePlot() { |
|
|
|
protected boolean isSamePlot() { |
|
|
|
return samePlot; |
|
|
|
return samePlot; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AbstractVanChartTypePane() { |
|
|
|
|
|
|
|
buttonPane = new JPanel(); |
|
|
|
|
|
|
|
buttonPane.setLayout(new BorderLayout()); |
|
|
|
|
|
|
|
if (ChartTypeManager.AUTO_CHART) { |
|
|
|
|
|
|
|
autoButton = new UIButton(Toolkit.i18nText("Fine-Design_Chart_M_Popup_Auto_Chart_Type"), |
|
|
|
|
|
|
|
BaseUtils.readIcon("/com/fr/design/images/m_insert/auto_chart.png")) { |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Dimension getPreferredSize() { |
|
|
|
|
|
|
|
return new Dimension((int) super.getPreferredSize().getWidth(), 25); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
buttonPane.setBorder((BorderFactory.createEmptyBorder(5, 0, 0, 0))); |
|
|
|
|
|
|
|
buttonPane.add(autoButton); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
protected Component[][] getPaneComponents(JPanel typePane) { |
|
|
|
|
|
|
|
return new Component[][]{ |
|
|
|
|
|
|
|
new Component[]{typePane}, |
|
|
|
|
|
|
|
new Component[]{buttonPane}, |
|
|
|
|
|
|
|
new Component[]{stylePane}, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//新图表暂时还没有平面3d,渐变高光等布局。
|
|
|
|
//新图表暂时还没有平面3d,渐变高光等布局。
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected String[] getTypeLayoutPath() { |
|
|
|
protected String[] getTypeLayoutPath() { |
|
|
@ -66,7 +102,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha |
|
|
|
return getPlotID(); |
|
|
|
return getPlotID(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected Component[][] getComponentsWithLargeData(JPanel typePane){ |
|
|
|
protected Component[][] getComponentsWithLargeData(JPanel typePane) { |
|
|
|
largeModelCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open_Large_Data_Model")); |
|
|
|
largeModelCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Open_Large_Data_Model")); |
|
|
|
MultilineLabel prompt = new MultilineLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Data_Model_Prompt")); |
|
|
|
MultilineLabel prompt = new MultilineLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Large_Data_Model_Prompt")); |
|
|
|
prompt.setForeground(Color.red); |
|
|
|
prompt.setForeground(Color.red); |
|
|
@ -84,7 +120,7 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha |
|
|
|
* 更新界面内容 |
|
|
|
* 更新界面内容 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void populateBean(Chart chart) { |
|
|
|
public void populateBean(Chart chart) { |
|
|
|
for(ChartImagePane imagePane : typeDemo) { |
|
|
|
for (ChartImagePane imagePane : typeDemo) { |
|
|
|
imagePane.isPressing = false; |
|
|
|
imagePane.isPressing = false; |
|
|
|
} |
|
|
|
} |
|
|
|
Plot plot = chart.getPlot(); |
|
|
|
Plot plot = chart.getPlot(); |
|
|
@ -100,13 +136,13 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha |
|
|
|
VanChartPlot newPlot = getSelectedClonedPlot(); |
|
|
|
VanChartPlot newPlot = getSelectedClonedPlot(); |
|
|
|
checkTypeChange(oldPlot); |
|
|
|
checkTypeChange(oldPlot); |
|
|
|
samePlot = accept(chart); |
|
|
|
samePlot = accept(chart); |
|
|
|
if(typeChanged && samePlot){ |
|
|
|
if (typeChanged && samePlot) { |
|
|
|
//同一中图表切换不同类型
|
|
|
|
//同一中图表切换不同类型
|
|
|
|
cloneOldPlot2New(oldPlot, newPlot); |
|
|
|
cloneOldPlot2New(oldPlot, newPlot); |
|
|
|
chart.setPlot(newPlot); |
|
|
|
chart.setPlot(newPlot); |
|
|
|
resetChartAttr4SamePlot(chart); |
|
|
|
resetChartAttr4SamePlot(chart); |
|
|
|
ChartInfoCollector.getInstance().updateChartMiniType(chart); |
|
|
|
ChartInfoCollector.getInstance().updateChartMiniType(chart); |
|
|
|
} else if(!samePlot){ |
|
|
|
} else if (!samePlot) { |
|
|
|
//不同的图表类型切換
|
|
|
|
//不同的图表类型切換
|
|
|
|
resetChartAttr(chart, newPlot); |
|
|
|
resetChartAttr(chart, newPlot); |
|
|
|
//切换图表时,数据配置不变,分类个数也不变
|
|
|
|
//切换图表时,数据配置不变,分类个数也不变
|
|
|
@ -114,55 +150,55 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha |
|
|
|
//切换类型埋点
|
|
|
|
//切换类型埋点
|
|
|
|
ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID()); |
|
|
|
ChartInfoCollector.getInstance().updateChartTypeTime(chart, oldPlot.getPlotID()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(chart instanceof VanChart |
|
|
|
if (chart instanceof VanChart |
|
|
|
&& !acceptDefinition(((VanChart) chart).getChartDataDefinition(), newPlot)) { |
|
|
|
&& !acceptDefinition(((VanChart) chart).getChartDataDefinition(), newPlot)) { |
|
|
|
((VanChart) chart).setChartDataDefinition(null); |
|
|
|
((VanChart) chart).setChartDataDefinition(null); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { |
|
|
|
protected boolean acceptDefinition(ChartDataDefinitionProvider definition, VanChartPlot vanChartPlot) { |
|
|
|
if(definition instanceof AbstractDataDefinition) { |
|
|
|
if (definition instanceof AbstractDataDefinition) { |
|
|
|
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(); |
|
|
|
AbstractColumnFieldCollection columnFieldCollection = ((AbstractDataDefinition) definition).getColumnFieldCollection(); |
|
|
|
return columnFieldCollection instanceof MultiCategoryColumnFieldCollection; |
|
|
|
return columnFieldCollection instanceof MultiCategoryColumnFieldCollection; |
|
|
|
} |
|
|
|
} |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void resetChartAttr4SamePlot(Chart chart){ |
|
|
|
protected void resetChartAttr4SamePlot(Chart chart) { |
|
|
|
resetRefreshMoreLabelAttr((VanChart) chart); |
|
|
|
resetRefreshMoreLabelAttr((VanChart) chart); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void resetChartAttr(Chart chart, Plot newPlot){ |
|
|
|
protected void resetChartAttr(Chart chart, Plot newPlot) { |
|
|
|
chart.setPlot(newPlot); |
|
|
|
chart.setPlot(newPlot); |
|
|
|
if(newPlot.isSupportZoomDirection() && !newPlot.isSupportZoomCategoryAxis()){ |
|
|
|
if (newPlot.isSupportZoomDirection() && !newPlot.isSupportZoomCategoryAxis()) { |
|
|
|
//图表缩放新设计 恢复用注释。下面一行删除。
|
|
|
|
//图表缩放新设计 恢复用注释。下面一行删除。
|
|
|
|
((VanChart) chart).setVanChartZoom(new VanChartZoom()); |
|
|
|
((VanChart) chart).setVanChartZoom(new VanChartZoom()); |
|
|
|
//图表缩放新设计 恢复用注释。下面一行取消注释。
|
|
|
|
//图表缩放新设计 恢复用注释。下面一行取消注释。
|
|
|
|
// ((VanChart) chart).setZoomAttribute(new ZoomAttribute());
|
|
|
|
// ((VanChart) chart).setZoomAttribute(new ZoomAttribute());
|
|
|
|
} |
|
|
|
} |
|
|
|
//重置工具栏选项
|
|
|
|
//重置工具栏选项
|
|
|
|
((VanChart)chart).setVanChartTools(createVanChartTools()); |
|
|
|
((VanChart) chart).setVanChartTools(createVanChartTools()); |
|
|
|
//重置标题选项
|
|
|
|
//重置标题选项
|
|
|
|
resetTitleAttr(chart); |
|
|
|
resetTitleAttr(chart); |
|
|
|
//重置监控刷新选项
|
|
|
|
//重置监控刷新选项
|
|
|
|
resetRefreshMoreLabelAttr((VanChart)chart); |
|
|
|
resetRefreshMoreLabelAttr((VanChart) chart); |
|
|
|
resetFilterDefinition(chart); |
|
|
|
resetFilterDefinition(chart); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//默认有标题
|
|
|
|
//默认有标题
|
|
|
|
protected void resetTitleAttr(Chart chart){ |
|
|
|
protected void resetTitleAttr(Chart chart) { |
|
|
|
VanChartPlot vanChartPlot = (VanChartPlot) chart.getPlot(); |
|
|
|
VanChartPlot vanChartPlot = (VanChartPlot) chart.getPlot(); |
|
|
|
chart.setTitle(vanChartPlot.getDefaultTitle()); |
|
|
|
chart.setTitle(vanChartPlot.getDefaultTitle()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//重置数据配置
|
|
|
|
//重置数据配置
|
|
|
|
protected void resetFilterDefinition(Chart chart){ |
|
|
|
protected void resetFilterDefinition(Chart chart) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//重置监控刷新面板
|
|
|
|
//重置监控刷新面板
|
|
|
|
protected void resetRefreshMoreLabelAttr(VanChart chart){ |
|
|
|
protected void resetRefreshMoreLabelAttr(VanChart chart) { |
|
|
|
chart.setRefreshMoreLabel(chart.getDefaultAutoAttrtooltip(chart)); |
|
|
|
chart.setRefreshMoreLabel(chart.getDefaultAutoAttrtooltip(chart)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -170,9 +206,9 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha |
|
|
|
return new VanChartTools(); |
|
|
|
return new VanChartTools(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void checkTypeChange(Plot oldPlot){ |
|
|
|
protected void checkTypeChange(Plot oldPlot) { |
|
|
|
for(int i = 0; i < typeDemo.size(); i++){ |
|
|
|
for (int i = 0; i < typeDemo.size(); i++) { |
|
|
|
if(typeDemo.get(i).isPressing && i != oldPlot.getDetailType()){ |
|
|
|
if (typeDemo.get(i).isPressing && i != oldPlot.getDetailType()) { |
|
|
|
typeChanged = true; |
|
|
|
typeChanged = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -193,15 +229,15 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha |
|
|
|
cloneHotHyperLink(oldPlot, newPlot); |
|
|
|
cloneHotHyperLink(oldPlot, newPlot); |
|
|
|
|
|
|
|
|
|
|
|
if (oldPlot.getPlotFillStyle() != null) { |
|
|
|
if (oldPlot.getPlotFillStyle() != null) { |
|
|
|
newPlot.setPlotFillStyle((AttrFillStyle)oldPlot.getPlotFillStyle().clone()); |
|
|
|
newPlot.setPlotFillStyle((AttrFillStyle) oldPlot.getPlotFillStyle().clone()); |
|
|
|
} |
|
|
|
} |
|
|
|
newPlot.setPlotStyle(oldPlot.getPlotStyle()); |
|
|
|
newPlot.setPlotStyle(oldPlot.getPlotStyle()); |
|
|
|
if (oldPlot.getDataSheet() != null) { |
|
|
|
if (oldPlot.getDataSheet() != null) { |
|
|
|
newPlot.setDataSheet((DataSheet)oldPlot.getDataSheet().clone()); |
|
|
|
newPlot.setDataSheet((DataSheet) oldPlot.getDataSheet().clone()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (oldPlot.getBackground() != null) { |
|
|
|
if (oldPlot.getBackground() != null) { |
|
|
|
newPlot.setBackground((Background)oldPlot.getBackground().clone()); |
|
|
|
newPlot.setBackground((Background) oldPlot.getBackground().clone()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (oldPlot.getBorderColor() != null) { |
|
|
|
if (oldPlot.getBorderColor() != null) { |
|
|
|
newPlot.setBorderColor(oldPlot.getBorderColor()); |
|
|
|
newPlot.setBorderColor(oldPlot.getBorderColor()); |
|
|
@ -211,20 +247,20 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha |
|
|
|
newPlot.setAlpha(oldPlot.getAlpha()); |
|
|
|
newPlot.setAlpha(oldPlot.getAlpha()); |
|
|
|
newPlot.setShadow(oldPlot.isShadow()); |
|
|
|
newPlot.setShadow(oldPlot.isShadow()); |
|
|
|
|
|
|
|
|
|
|
|
((VanChartPlot)newPlot).setCategoryNum( ((VanChartPlot)oldPlot).getCategoryNum()); |
|
|
|
((VanChartPlot) newPlot).setCategoryNum(((VanChartPlot) oldPlot).getCategoryNum()); |
|
|
|
|
|
|
|
|
|
|
|
} catch (CloneNotSupportedException e) { |
|
|
|
} catch (CloneNotSupportedException e) { |
|
|
|
FineLoggerFactory.getLogger().error("Error in change plot"); |
|
|
|
FineLoggerFactory.getLogger().error("Error in change plot"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ |
|
|
|
protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { |
|
|
|
if (oldPlot.getHotHyperLink() != null) { |
|
|
|
if (oldPlot.getHotHyperLink() != null) { |
|
|
|
newPlot.setHotHyperLink((NameJavaScriptGroup)oldPlot.getHotHyperLink().clone()); |
|
|
|
newPlot.setHotHyperLink((NameJavaScriptGroup) oldPlot.getHotHyperLink().clone()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ |
|
|
|
protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { |
|
|
|
if (oldPlot.getConditionCollection() != null) { |
|
|
|
if (oldPlot.getConditionCollection() != null) { |
|
|
|
ConditionCollection newCondition = new ConditionCollection(); |
|
|
|
ConditionCollection newCondition = new ConditionCollection(); |
|
|
|
newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone()); |
|
|
|
newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone()); |
|
|
@ -232,9 +268,16 @@ public abstract class AbstractVanChartTypePane extends AbstractChartTypePane<Cha |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ |
|
|
|
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { |
|
|
|
if (oldPlot.getConditionCollection() != null) { |
|
|
|
if (oldPlot.getConditionCollection() != null) { |
|
|
|
newPlot.setConditionCollection((ConditionCollection)oldPlot.getConditionCollection().clone()); |
|
|
|
newPlot.setConditionCollection((ConditionCollection) oldPlot.getConditionCollection().clone()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void registerButtonListener(ActionListener autoButtonListener) { |
|
|
|
|
|
|
|
if (autoButton != null) { |
|
|
|
|
|
|
|
autoButton.addActionListener(autoButtonListener); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |