* commit 'be3c8aa5945b9c68784ac1ce0e35e581454b48db': (25 commits) 地图获取参数&phantom request image end callback repaint update chart demo image 坐标轴系列等面板 .DS_Store 9.0面板修改 修改方法 修改方法名称 条件属性存取classpath 重命名类名 9.0新图表配置面板调整 修改类名称 修改FormatPane 4 vanchart 调整一下标题和图例的显示策略部分 9.0新图表面板调整: 1、样式:标签面板 2、样式:提示面板 3、样式:数据表面板 修改方法名称 update 添加地图数据目录 删掉部分代码 修改继承关系 ...master
After Width: | Height: | Size: 374 B |
After Width: | Height: | Size: 178 B |
After Width: | Height: | Size: 493 B |
After Width: | Height: | Size: 179 B |
After Width: | Height: | Size: 306 B |
After Width: | Height: | Size: 344 B |
After Width: | Height: | Size: 276 B |
After Width: | Height: | Size: 982 B |
After Width: | Height: | Size: 431 B |
After Width: | Height: | Size: 750 B |
After Width: | Height: | Size: 447 B |
After Width: | Height: | Size: 344 B |
After Width: | Height: | Size: 861 B |
After Width: | Height: | Size: 372 B |
After Width: | Height: | Size: 723 B |
After Width: | Height: | Size: 429 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 269 B |
After Width: | Height: | Size: 654 B |
After Width: | Height: | Size: 423 B |
After Width: | Height: | Size: 503 B |
After Width: | Height: | Size: 306 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 559 B |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 423 B |
After Width: | Height: | Size: 861 B |
After Width: | Height: | Size: 1002 B |
After Width: | Height: | Size: 329 B |
After Width: | Height: | Size: 269 B |
@ -1 +1,92 @@ |
|||||||
package com.fr.design.module;
import com.fr.chart.base.ChartInternationalNameContentBean;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.chart.ChartDialog;
import com.fr.design.chart.gui.ChartComponent;
import com.fr.design.chart.gui.ChartWidgetOption;
import com.fr.design.gui.core.WidgetOption;
import com.fr.design.mainframe.App;
import com.fr.design.mainframe.ChartPropertyPane;
import com.fr.form.ui.ChartEditor;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.stable.ArrayUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import javax.swing.*;
/**
* Created by IntelliJ IDEA.
* Author : Richer
* Version: 7.0.3
* Date: 13-7-8
* Time: 上午9:13
*/
public class ChartDesignerModule extends DesignModule {
public void start() {
super.start();
dealBeforeRegister();
register();
registerFloatEditor();
}
protected void dealBeforeRegister(){
StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class);
StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class);
}
private void register(){
DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup());
DesignModuleFactory.registerChartEditorClass(ChartEditor.class);
DesignModuleFactory.registerChartComponentClass(ChartComponent.class);
DesignModuleFactory.registerChartDialogClass(ChartDialog.class);
DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class);
ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction());
}
protected void registerFloatEditor() {
ActionFactory.registerChartCollection(ChartCollection.class);
}
/**
* 返回设计器能打开的模板类型的一个数组列表
*
* @return 可以打开的模板类型的数组
*/
public App<?>[] apps4TemplateOpener() {
return new App[0];
}
protected WidgetOption[] options4Show() {
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
for (int i = 0; i < typeName.length; i++) {
String plotID = typeName[i].getPlotID();
Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID);
if (ArrayUtils.isEmpty(rowChart)) {
continue;
}
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID);
Icon icon = IOUtils.readIcon(iconPath);
child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]);
}
return child;
}
public String getInterNationalName() {
return Inter.getLocText("FR-Chart-Design_ChartModule");
}
} |
package com.fr.design.module; |
||||||
|
|
||||||
|
import com.fr.chart.base.ChartInternationalNameContentBean; |
||||||
|
import com.fr.chart.chartattr.Chart; |
||||||
|
import com.fr.chart.chartattr.ChartCollection; |
||||||
|
import com.fr.chart.charttypes.ChartTypeManager; |
||||||
|
import com.fr.design.ChartTypeInterfaceManager; |
||||||
|
import com.fr.design.actions.core.ActionFactory; |
||||||
|
import com.fr.design.chart.ChartDialog; |
||||||
|
import com.fr.design.chart.gui.ChartComponent; |
||||||
|
import com.fr.design.chart.gui.ChartWidgetOption; |
||||||
|
import com.fr.design.gui.core.WidgetOption; |
||||||
|
import com.fr.design.mainframe.App; |
||||||
|
import com.fr.design.mainframe.ChartPropertyPane; |
||||||
|
import com.fr.form.ui.ChartEditor; |
||||||
|
import com.fr.general.IOUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.map.server.ChartMapEditorAction; |
||||||
|
import com.fr.stable.ArrayUtils; |
||||||
|
import com.fr.stable.bridge.StableFactory; |
||||||
|
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by IntelliJ IDEA. |
||||||
|
* Author : Richer |
||||||
|
* Version: 7.0.3 |
||||||
|
* Date: 13-7-8 |
||||||
|
* Time: 上午9:13 |
||||||
|
*/ |
||||||
|
public class ChartDesignerModule extends DesignModule { |
||||||
|
public void start() { |
||||||
|
super.start(); |
||||||
|
dealBeforeRegister(); |
||||||
|
register(); |
||||||
|
registerFloatEditor(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void dealBeforeRegister(){ |
||||||
|
StableFactory.registerMarkedClass(ExtraChartDesignClassManagerProvider.XML_TAG, ChartTypeInterfaceManager.class); |
||||||
|
StableFactory.getStaticMarkedInstanceObjectFromClass(ExtraChartDesignClassManagerProvider.XML_TAG, ExtraChartDesignClassManagerProvider.class); |
||||||
|
} |
||||||
|
|
||||||
|
private void register(){ |
||||||
|
DesignModuleFactory.registerHyperlinkGroupType(new ChartHyperlinkGroup()); |
||||||
|
|
||||||
|
DesignModuleFactory.registerChartEditorClass(ChartEditor.class); |
||||||
|
DesignModuleFactory.registerChartComponentClass(ChartComponent.class); |
||||||
|
|
||||||
|
DesignModuleFactory.registerChartDialogClass(ChartDialog.class); |
||||||
|
|
||||||
|
DesignModuleFactory.registerChartPropertyPaneClass(ChartPropertyPane.class); |
||||||
|
|
||||||
|
ActionFactory.registerChartPreStyleAction(new ChartPreStyleAction()); |
||||||
|
ActionFactory.registerChartMapEditorAction(new ChartMapEditorAction()); |
||||||
|
} |
||||||
|
|
||||||
|
protected void registerFloatEditor() { |
||||||
|
ActionFactory.registerChartCollection(ChartCollection.class); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回设计器能打开的模板类型的一个数组列表 |
||||||
|
* |
||||||
|
* @return 可以打开的模板类型的数组 |
||||||
|
*/ |
||||||
|
public App<?>[] apps4TemplateOpener() { |
||||||
|
return new App[0]; |
||||||
|
} |
||||||
|
protected WidgetOption[] options4Show() { |
||||||
|
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames(); |
||||||
|
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length]; |
||||||
|
for (int i = 0; i < typeName.length; i++) { |
||||||
|
String plotID = typeName[i].getPlotID(); |
||||||
|
Chart[] rowChart = ChartTypeManager.getInstance().getChartTypes(plotID); |
||||||
|
if (ArrayUtils.isEmpty(rowChart)) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); |
||||||
|
Icon icon = IOUtils.readIcon(iconPath); |
||||||
|
child[i] = new ChartWidgetOption(Inter.getLocText(typeName[i].getName()), icon, ChartEditor.class, rowChart[0]); |
||||||
|
} |
||||||
|
return child; |
||||||
|
} |
||||||
|
|
||||||
|
public String getInterNationalName() { |
||||||
|
return Inter.getLocText("FR-Chart-Design_ChartModule"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
@ -0,0 +1,40 @@ |
|||||||
|
package com.fr.plugin.chart.area; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.condition.ConditionAttributesPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||||
|
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||||
|
import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 15/11/18. |
||||||
|
*/ |
||||||
|
public class AreaIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { |
||||||
|
@Override |
||||||
|
public String getIconPath() { |
||||||
|
return "com/fr/design/images/form/toolbar/area.png"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public AbstractChartTypePane getPlotTypePane() { |
||||||
|
return new VanChartAreaPlotPane(); |
||||||
|
} |
||||||
|
|
||||||
|
public ConditionAttributesPane getPlotConditionPane(Plot plot){ |
||||||
|
return new VanChartAreaConditionPane(plot); |
||||||
|
} |
||||||
|
|
||||||
|
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){ |
||||||
|
return new VanChartAreaSeriesPane(parent, plot); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* plot面板的标题 |
||||||
|
* 插件兼容 |
||||||
|
*/ |
||||||
|
public String getPlotTypeTitle4PopupWindow(){ |
||||||
|
return VanChartAreaPlotPane.TITLE; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,96 @@ |
|||||||
|
package com.fr.plugin.chart.area; |
||||||
|
|
||||||
|
import com.fr.chart.base.AttrBackground; |
||||||
|
import com.fr.chart.base.ChartConstants; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||||
|
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; |
||||||
|
import com.fr.plugin.chart.attr.EffectHelper; |
||||||
|
import com.fr.plugin.chart.base.AttrAreaSeriesFillColorBackground; |
||||||
|
import com.fr.plugin.chart.base.AttrDataSheet; |
||||||
|
import com.fr.plugin.chart.base.AttrEffect; |
||||||
|
import com.fr.plugin.chart.base.AttrLabel; |
||||||
|
import com.fr.plugin.chart.base.AttrTooltip; |
||||||
|
import com.fr.plugin.chart.base.VanChartAttrLine; |
||||||
|
import com.fr.plugin.chart.base.VanChartAttrMarker; |
||||||
|
import com.fr.plugin.chart.base.VanChartAttrTrendLine; |
||||||
|
import com.fr.plugin.chart.designer.PlotFactory; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartAreaFillColorConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartDataSheetContentPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartLineTypeConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartMarkerConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartTrendLineConditionPane; |
||||||
|
import com.fr.plugin.chart.glyph.VanChartMultiCategoryDataPoint; |
||||||
|
import com.fr.plugin.chart.scatter.large.VanChartLargeModelMarkerConditionPane; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 15/11/18. |
||||||
|
*/ |
||||||
|
public class VanChartAreaConditionPane extends DataSeriesConditionPane { |
||||||
|
private static final long serialVersionUID = -7180705321732069806L; |
||||||
|
|
||||||
|
public VanChartAreaConditionPane(Plot plot) { |
||||||
|
super(plot); |
||||||
|
} |
||||||
|
|
||||||
|
protected void initComponents() { |
||||||
|
super.initComponents(); |
||||||
|
//添加全部条件属性后被遮挡
|
||||||
|
liteConditionPane.setPreferredSize(new Dimension(300, 400)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void addBasicAction() { |
||||||
|
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); |
||||||
|
classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this)); |
||||||
|
classPaneMap.put(AttrAreaSeriesFillColorBackground.class, new VanChartAreaFillColorConditionPane(this, plot)); |
||||||
|
classPaneMap.put(VanChartAttrLine.class, new VanChartLineTypeConditionPane(this)); |
||||||
|
classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot)); |
||||||
|
//是否使用数据表
|
||||||
|
if (plot.getDataSheet().isVisible()) { |
||||||
|
classPaneMap.put(AttrDataSheet.class, new VanChartDataSheetContentPane(this, plot)); |
||||||
|
} |
||||||
|
if(PlotFactory.largeDataModel(plot)){ |
||||||
|
classPaneMap.put(VanChartAttrMarker.class, new VanChartLargeModelMarkerConditionPane(this)); |
||||||
|
} else { |
||||||
|
classPaneMap.put(VanChartAttrMarker.class, new VanChartMarkerConditionPane(this)); |
||||||
|
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getAreaPlotDefaultEffect())); |
||||||
|
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void addStyleAction() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected ChartConditionPane createListConditionPane() { |
||||||
|
return new ChartConditionPane(){ |
||||||
|
@Override |
||||||
|
public String[] columns2Populate() { |
||||||
|
return new String[]{ |
||||||
|
ChartConstants.CATEGORY_INDEX, |
||||||
|
ChartConstants.CATEGORY_NAME, |
||||||
|
ChartConstants.SERIES_INDEX, |
||||||
|
ChartConstants.SERIES_NAME, |
||||||
|
ChartConstants.VALUE, |
||||||
|
VanChartMultiCategoryDataPoint.CATEGORY_ARRAY, |
||||||
|
}; |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回图表class对象 |
||||||
|
* @return class对象 |
||||||
|
*/ |
||||||
|
public Class<? extends Plot> class4Correspond() { |
||||||
|
return VanChartAreaPlot.class; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,95 @@ |
|||||||
|
package com.fr.plugin.chart.area; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Chart; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; |
||||||
|
import com.fr.general.FRLogger; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 15/11/18. |
||||||
|
*/ |
||||||
|
public class VanChartAreaPlotPane extends AbstractVanChartTypePane { |
||||||
|
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewArea"); |
||||||
|
private static final long serialVersionUID = -8161581682558781651L; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String[] getTypeIconPath() { |
||||||
|
|
||||||
|
return new String[]{"/com/fr/plugin/chart/area/images/area.png", |
||||||
|
"/com/fr/plugin/chart/area/images/stack.png", |
||||||
|
"/com/fr/plugin/chart/area/images/percentStack.png", |
||||||
|
"/com/fr/plugin/chart/area/images/custom.png", |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String[] getTypeTipName() { |
||||||
|
String area = Inter.getLocText("FR-Chart-Type_Area"); |
||||||
|
String stack = Inter.getLocText("FR-Chart-Type_Stacked"); |
||||||
|
String percent = Inter.getLocText("FR-Chart-Use_Percent"); |
||||||
|
return new String[]{ |
||||||
|
area, |
||||||
|
stack + area, |
||||||
|
percent + stack + area, |
||||||
|
Inter.getLocText("FR-Chart-Mode_Custom") |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回界面标题 |
||||||
|
* @return 界面标题 |
||||||
|
*/ |
||||||
|
public String title4PopupWindow() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_NewArea"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新界面内容 |
||||||
|
*/ |
||||||
|
public void populateBean(Chart chart) { |
||||||
|
for(ChartImagePane imagePane : typeDemo) { |
||||||
|
imagePane.isPressing = false; |
||||||
|
} |
||||||
|
Plot plot = chart.getPlot(); |
||||||
|
if(plot instanceof VanChartAreaPlot) { |
||||||
|
lastTypeIndex = ((VanChartAreaPlot) plot).getVanChartPlotType().ordinal(); |
||||||
|
typeDemo.get(lastTypeIndex).isPressing = true; |
||||||
|
} |
||||||
|
checkDemosBackground(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 获取各图表类型界面ID, 本质是plotID |
||||||
|
* |
||||||
|
* @return 图表类型界面ID |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
protected String getPlotTypeID() { |
||||||
|
return VanChartAreaPlot.VAN_CHART_AREA_PLOT_ID; |
||||||
|
} |
||||||
|
|
||||||
|
protected Plot getSelectedClonedPlot(){ |
||||||
|
VanChartAreaPlot newPlot = null; |
||||||
|
Chart[] areaChart = AreaIndependentVanChart.AreaVanChartTypes; |
||||||
|
for(int i = 0, len = areaChart.length; i < len; i++){ |
||||||
|
if(typeDemo.get(i).isPressing){ |
||||||
|
newPlot = (VanChartAreaPlot)areaChart[i].getPlot(); |
||||||
|
} |
||||||
|
} |
||||||
|
Plot cloned = null; |
||||||
|
try { |
||||||
|
cloned = (Plot)newPlot.clone(); |
||||||
|
} catch (CloneNotSupportedException e) { |
||||||
|
FRLogger.getLogger().error("Error In AreaChart"); |
||||||
|
} |
||||||
|
return cloned; |
||||||
|
} |
||||||
|
|
||||||
|
public Chart getDefaultChart() { |
||||||
|
return AreaIndependentVanChart.AreaVanChartTypes[0]; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,51 @@ |
|||||||
|
package com.fr.plugin.chart.area; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||||
|
import com.fr.plugin.chart.column.VanChartCustomStackAndAxisConditionPane; |
||||||
|
import com.fr.plugin.chart.line.VanChartLineSeriesPane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
public class VanChartAreaSeriesPane extends VanChartLineSeriesPane{ |
||||||
|
|
||||||
|
private static final long serialVersionUID = 5497989595104913025L; |
||||||
|
|
||||||
|
public VanChartAreaSeriesPane(ChartStylePane parent, Plot plot){ |
||||||
|
super(parent, plot); |
||||||
|
} |
||||||
|
|
||||||
|
protected JPanel getContentInPlotType(){ |
||||||
|
|
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double[] row = {p,p,p,p,p,p,p,p,p,p,p,p}; |
||||||
|
double[] col = {f}; |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{createStylePane()}, |
||||||
|
new Component[]{stylePane == null ? null : new JSeparator()}, |
||||||
|
new Component[]{createLineTypePane()}, |
||||||
|
new Component[]{new JSeparator()}, |
||||||
|
new Component[]{createMarkerPane()}, |
||||||
|
new Component[]{new JSeparator()}, |
||||||
|
new Component[]{createAreaFillColorPane()}, |
||||||
|
new Component[]{new JSeparator()}, |
||||||
|
new Component[]{createStackedAndAxisPane()}, |
||||||
|
new Component[]{createLargeDataModelPane()}, |
||||||
|
new Component[]{new JSeparator()}, |
||||||
|
new Component[]{createTrendLinePane()}, |
||||||
|
}; |
||||||
|
|
||||||
|
contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); |
||||||
|
return contentPane; |
||||||
|
} |
||||||
|
|
||||||
|
protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() { |
||||||
|
return VanChartCustomStackAndAxisConditionPane.class; |
||||||
|
} |
||||||
|
} |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 760 B |
After Width: | Height: | Size: 728 B |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,56 @@ |
|||||||
|
package com.fr.plugin.chart.bar; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
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.gui.ChartStylePane; |
||||||
|
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||||
|
import com.fr.plugin.chart.column.VanChartColumnConditionPane; |
||||||
|
import com.fr.plugin.chart.column.VanChartColumnSeriesPane; |
||||||
|
import com.fr.plugin.chart.designer.other.VanChartOtherPane; |
||||||
|
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||||
|
import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 15/10/20. |
||||||
|
*/ |
||||||
|
public class BarIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { |
||||||
|
@Override |
||||||
|
public String getIconPath() { |
||||||
|
return "com/fr/design/images/form/toolbar/bar.png"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public AbstractChartTypePane getPlotTypePane() { |
||||||
|
return new VanChartBarPlotPane(); |
||||||
|
} |
||||||
|
|
||||||
|
public ConditionAttributesPane getPlotConditionPane(Plot plot){ |
||||||
|
return new VanChartColumnConditionPane(plot); |
||||||
|
} |
||||||
|
|
||||||
|
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){ |
||||||
|
return new VanChartColumnSeriesPane(parent, plot); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 图表的属性界面数组 |
||||||
|
* @return 属性界面 |
||||||
|
*/ |
||||||
|
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ |
||||||
|
VanChartStylePane stylePane = new VanChartBarStylePane(listener); |
||||||
|
VanChartOtherPane otherPane = new VanChartOtherPane(); |
||||||
|
return new AbstractChartAttrPane[]{stylePane, otherPane}; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* plot面板的标题 |
||||||
|
* 插件兼容 |
||||||
|
*/ |
||||||
|
public String getPlotTypeTitle4PopupWindow(){ |
||||||
|
return VanChartBarPlotPane.TITLE; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,96 @@ |
|||||||
|
package com.fr.plugin.chart.bar; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Chart; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; |
||||||
|
import com.fr.general.FRLogger; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.column.VanChartColumnPlot; |
||||||
|
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 15/10/20. |
||||||
|
*/ |
||||||
|
public class VanChartBarPlotPane extends AbstractVanChartTypePane { |
||||||
|
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewBar"); |
||||||
|
|
||||||
|
private static final long serialVersionUID = 2879689884048643002L; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String[] getTypeIconPath() { |
||||||
|
return new String[]{"/com/fr/plugin/chart/bar/images/bar.png", |
||||||
|
"/com/fr/plugin/chart/bar/images/stack.png", |
||||||
|
"/com/fr/plugin/chart/bar/images/percentstack.png", |
||||||
|
"/com/fr/plugin/chart/bar/images/custom.png", |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String[] getTypeTipName() { |
||||||
|
String bar = Inter.getLocText("FR-Chart-Type_Bar"); |
||||||
|
String stack = Inter.getLocText("FR-Chart-Type_Stacked"); |
||||||
|
String percent = Inter.getLocText("FR-Chart-Use_Percent"); |
||||||
|
return new String[]{ |
||||||
|
bar, |
||||||
|
stack + bar, |
||||||
|
percent + stack + bar, |
||||||
|
Inter.getLocText("FR-Chart-Mode_Custom") |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回界面标题 |
||||||
|
* @return 界面标题 |
||||||
|
*/ |
||||||
|
public String title4PopupWindow() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_NewBar"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新界面内容 |
||||||
|
*/ |
||||||
|
public void populateBean(Chart chart) { |
||||||
|
for(ChartImagePane imagePane : typeDemo) { |
||||||
|
imagePane.isPressing = false; |
||||||
|
} |
||||||
|
Plot plot = chart.getPlot(); |
||||||
|
if(plot instanceof VanChartColumnPlot) { |
||||||
|
lastTypeIndex = ((VanChartColumnPlot)plot).getVanChartPlotType().ordinal(); |
||||||
|
typeDemo.get(lastTypeIndex).isPressing = true; |
||||||
|
} |
||||||
|
checkDemosBackground(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取各图表类型界面ID, 本质是plotID |
||||||
|
* |
||||||
|
* @return 图表类型界面ID |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
protected String getPlotTypeID() { |
||||||
|
return VanChartColumnPlot.VAN_CHART_BAR_PLOT_ID; |
||||||
|
} |
||||||
|
|
||||||
|
protected Plot getSelectedClonedPlot(){ |
||||||
|
VanChartColumnPlot newPlot = null; |
||||||
|
Chart[] barChart = BarIndependentVanChart.BarVanChartTypes; |
||||||
|
for(int i = 0, len = barChart.length; i < len; i++){ |
||||||
|
if(typeDemo.get(i).isPressing){ |
||||||
|
newPlot = (VanChartColumnPlot)barChart[i].getPlot(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Plot cloned = null; |
||||||
|
try { |
||||||
|
cloned = (Plot)newPlot.clone(); |
||||||
|
} catch (CloneNotSupportedException e) { |
||||||
|
FRLogger.getLogger().error("Error In ColumnChart"); |
||||||
|
} |
||||||
|
return cloned; |
||||||
|
} |
||||||
|
|
||||||
|
public Chart getDefaultChart() { |
||||||
|
return BarIndependentVanChart.BarVanChartTypes[0]; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
package com.fr.plugin.chart.bar; |
||||||
|
|
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||||
|
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; |
||||||
|
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||||
|
import com.fr.plugin.chart.designer.style.axis.bar.VanChartBarAxisPane; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/6/8. |
||||||
|
*/ |
||||||
|
public class VanChartBarStylePane extends VanChartStylePane { |
||||||
|
public VanChartBarStylePane(AttributeChangeListener listener) { |
||||||
|
super(listener); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void createVanChartAxisPane(List<BasicPane> paneList, VanChartAxisPlot plot) { |
||||||
|
paneList.add(new VanChartBarAxisPane(plot, VanChartBarStylePane.this)); |
||||||
|
} |
||||||
|
} |
After Width: | Height: | Size: 290 B |
After Width: | Height: | Size: 261 B |
After Width: | Height: | Size: 247 B |
After Width: | Height: | Size: 256 B |
@ -0,0 +1,85 @@ |
|||||||
|
package com.fr.plugin.chart.bubble; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Chart; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
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.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.report.BubblePlotReportDataContentPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||||
|
import com.fr.plugin.chart.bubble.data.VanChartBubblePlotTableDataContentPane; |
||||||
|
import com.fr.plugin.chart.designer.other.VanChartOtherPane; |
||||||
|
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||||
|
import com.fr.plugin.chart.vanchart.AbstractIndependentVanChartUI; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/3/31. |
||||||
|
*/ |
||||||
|
public class BubbleIndependentVanChartInterface extends AbstractIndependentVanChartUI { |
||||||
|
/** |
||||||
|
* 图表的类型定义界面类型,就是属性表的第一个界面 |
||||||
|
* |
||||||
|
* @return 图表的类型定义界面类型 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public AbstractChartTypePane getPlotTypePane() { |
||||||
|
return new VanChartBubblePlotPane(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 图标路径 |
||||||
|
* |
||||||
|
* @return 图标路径 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public String getIconPath() { |
||||||
|
return "com/fr/design/images/form/toolbar/bubble.png"; |
||||||
|
} |
||||||
|
@Override |
||||||
|
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){ |
||||||
|
return new VanChartBubbleSeriesPane(parent, plot); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent){ |
||||||
|
if(((VanChartBubblePlot) plot).isForceBubble()){ |
||||||
|
return super.getTableDataSourcePane(plot, parent); |
||||||
|
} |
||||||
|
return new VanChartBubblePlotTableDataContentPane(parent); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent){ |
||||||
|
if(((VanChartBubblePlot) plot).isForceBubble()){ |
||||||
|
return super.getReportDataSourcePane(plot, parent); |
||||||
|
} |
||||||
|
return new BubblePlotReportDataContentPane(parent); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 图表的属性界面数组 |
||||||
|
* @return 属性界面 |
||||||
|
*/ |
||||||
|
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ |
||||||
|
VanChartStylePane stylePane = new VanChartBubbleStylePane(listener); |
||||||
|
VanChartOtherPane otherPane = new VanChartOtherPane(){ |
||||||
|
protected BasicBeanPane<Chart> createInteractivePane() { |
||||||
|
return new VanChartBubbleInteractivePane(); |
||||||
|
} |
||||||
|
}; |
||||||
|
return new AbstractChartAttrPane[]{stylePane, otherPane}; |
||||||
|
} |
||||||
|
|
||||||
|
public ConditionAttributesPane getPlotConditionPane(Plot plot){ |
||||||
|
return new VanChartBubbleConditionPane(plot); |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlotTypeTitle4PopupWindow(){ |
||||||
|
return VanChartBubblePlotPane.TITLE; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,94 @@ |
|||||||
|
package com.fr.plugin.chart.bubble; |
||||||
|
|
||||||
|
import com.fr.chart.base.AttrAlpha; |
||||||
|
import com.fr.chart.base.AttrBackground; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||||
|
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; |
||||||
|
import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane; |
||||||
|
import com.fr.plugin.chart.attr.EffectHelper; |
||||||
|
import com.fr.plugin.chart.base.AttrEffect; |
||||||
|
import com.fr.plugin.chart.base.AttrLabel; |
||||||
|
import com.fr.plugin.chart.base.AttrTooltip; |
||||||
|
import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; |
||||||
|
import com.fr.plugin.chart.designer.PlotFactory; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartBubbleSetConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane; |
||||||
|
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; |
||||||
|
import com.fr.plugin.chart.scatter.attr.ScatterAttrTooltip; |
||||||
|
import com.fr.plugin.chart.scatter.component.label.VanChartScatterLabelConditionPane; |
||||||
|
import com.fr.plugin.chart.scatter.component.tooltip.VanChartScatterTooltipConditionPane; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/3/31. |
||||||
|
*/ |
||||||
|
public class VanChartBubbleConditionPane extends DataSeriesConditionPane { |
||||||
|
private static final long serialVersionUID = -7180705321732069806L; |
||||||
|
|
||||||
|
public VanChartBubbleConditionPane(Plot plot) { |
||||||
|
super(plot); |
||||||
|
} |
||||||
|
|
||||||
|
protected void initComponents() { |
||||||
|
super.initComponents(); |
||||||
|
//添加全部条件属性后被遮挡
|
||||||
|
liteConditionPane.setPreferredSize(new Dimension(300, 400)); |
||||||
|
} |
||||||
|
|
||||||
|
private boolean forceBubble() { |
||||||
|
return plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected ChartConditionPane createListConditionPane() { |
||||||
|
return forceBubble() ? new ChartConditionPane() : new VanChartBubbleConditionSelectionPane(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void addBasicAction() { |
||||||
|
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); |
||||||
|
classPaneMap.put(VanChartAttrBubble.class, new VanChartBubbleSetConditionPane(this)); |
||||||
|
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); |
||||||
|
|
||||||
|
if(forceBubble()){ |
||||||
|
addForceAction(); |
||||||
|
} else if(PlotFactory.largeDataModel(plot)){ |
||||||
|
addLargeAction(); |
||||||
|
} else { |
||||||
|
addNormalAction(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void addNormalAction() { |
||||||
|
classPaneMap.put(ScatterAttrLabel.class, new VanChartScatterLabelConditionPane(this, plot)); |
||||||
|
classPaneMap.put(ScatterAttrTooltip.class, new VanChartScatterTooltipConditionPane(this, plot)); |
||||||
|
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getBubblePlotDefaultEffect())); |
||||||
|
} |
||||||
|
|
||||||
|
private void addForceAction() { |
||||||
|
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot)); |
||||||
|
classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot)); |
||||||
|
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getBubblePlotDefaultEffect())); |
||||||
|
} |
||||||
|
|
||||||
|
private void addLargeAction() { |
||||||
|
classPaneMap.put(ScatterAttrTooltip.class, new VanChartScatterTooltipConditionPane(this, plot)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected void addStyleAction() { |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回图表class对象 |
||||||
|
* @return class对象 |
||||||
|
*/ |
||||||
|
public Class<? extends Plot> class4Correspond() { |
||||||
|
return VanChartBubblePlot.class; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package com.fr.plugin.chart.bubble; |
||||||
|
|
||||||
|
import com.fr.chart.base.ChartConstants; |
||||||
|
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||||
|
import com.fr.plugin.chart.scatter.VanChartScatterDataPoint; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/3/31. |
||||||
|
*/ |
||||||
|
public class VanChartBubbleConditionSelectionPane extends ChartConditionPane { |
||||||
|
|
||||||
|
|
||||||
|
public String[] columns2Populate() { |
||||||
|
return new String[]{ |
||||||
|
ChartConstants.SERIES_INDEX, |
||||||
|
ChartConstants.SERIES_NAME, |
||||||
|
VanChartScatterDataPoint.X, |
||||||
|
VanChartScatterDataPoint.Y, |
||||||
|
ChartConstants.VALUE |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
package com.fr.plugin.chart.bubble; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.base.VanChartConstants; |
||||||
|
import com.fr.plugin.chart.designer.other.VanChartInteractivePaneWithOutSort; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/3/31. |
||||||
|
*/ |
||||||
|
public class VanChartBubbleInteractivePane extends VanChartInteractivePaneWithOutSort { |
||||||
|
protected String[] getNameArray() { |
||||||
|
Plot plot = chart.getPlot(); |
||||||
|
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { |
||||||
|
return new String[]{Inter.getLocText("Plugin-ChartF_XYAxis"), Inter.getLocText("Chart-Use_None")}; |
||||||
|
} |
||||||
|
return super.getNameArray(); |
||||||
|
} |
||||||
|
|
||||||
|
protected String[] getValueArray() { |
||||||
|
Plot plot = chart.getPlot(); |
||||||
|
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot) plot).isForceBubble()) { |
||||||
|
return new String[]{VanChartConstants.ZOOM_TYPE_XY, VanChartConstants.ZOOM_TYPE_NONE}; |
||||||
|
} |
||||||
|
return super.getValueArray(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,171 @@ |
|||||||
|
package com.fr.plugin.chart.bubble; |
||||||
|
|
||||||
|
import com.fr.chart.base.AttrAlpha; |
||||||
|
import com.fr.chart.base.DataSeriesCondition; |
||||||
|
import com.fr.chart.chartattr.Chart; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.chart.chartglyph.ConditionAttr; |
||||||
|
import com.fr.chart.chartglyph.ConditionCollection; |
||||||
|
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; |
||||||
|
import com.fr.general.FRLogger; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.base.VanChartTools; |
||||||
|
import com.fr.plugin.chart.base.VanChartZoom; |
||||||
|
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; |
||||||
|
import com.fr.plugin.chart.scatter.attr.ScatterAttrLabel; |
||||||
|
import com.fr.plugin.chart.vanchart.VanChart; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/3/31. |
||||||
|
*/ |
||||||
|
public class VanChartBubblePlotPane extends AbstractVanChartTypePane { |
||||||
|
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewBubble");; |
||||||
|
|
||||||
|
private static final long serialVersionUID = -3481633368542654247L; |
||||||
|
|
||||||
|
private static final float FORCE_ALPHA = 1.0f; |
||||||
|
|
||||||
|
private static final float ALPHA = 0.7f; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String[] getTypeIconPath() { |
||||||
|
return new String[]{"/com/fr/plugin/chart/bubble/images/bubble.png", |
||||||
|
"/com/fr/plugin/chart/bubble/images/force.png" |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String[] getTypeTipName() { |
||||||
|
return new String[]{ |
||||||
|
Inter.getLocText("FR-Chart-Chart_BubbleChart"), |
||||||
|
Inter.getLocText("Plugin-ChartF_NewForceBubble") |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回界面标题 |
||||||
|
* @return 界面标题 |
||||||
|
*/ |
||||||
|
public String title4PopupWindow() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_NewBubble"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新界面内容 |
||||||
|
*/ |
||||||
|
public void populateBean(Chart chart) { |
||||||
|
for(ChartImagePane imagePane : typeDemo) { |
||||||
|
imagePane.isPressing = false; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Plot plot = chart.getPlot(); |
||||||
|
if(plot instanceof VanChartBubblePlot && ((VanChartBubblePlot)plot).isForceBubble()){ |
||||||
|
lastTypeIndex = BubblePlotType.FORCE.ordinal(); |
||||||
|
} else { |
||||||
|
lastTypeIndex = BubblePlotType.NORMAL.ordinal(); |
||||||
|
} |
||||||
|
|
||||||
|
typeDemo.get(lastTypeIndex).isPressing = true; |
||||||
|
|
||||||
|
checkDemosBackground(); |
||||||
|
} |
||||||
|
|
||||||
|
private void removeDefaultAttr(ConditionAttr conditionAttr, Class <? extends DataSeriesCondition> targetClass) { |
||||||
|
DataSeriesCondition attr = conditionAttr.getExisted(targetClass); |
||||||
|
if (attr != null){ |
||||||
|
conditionAttr.remove(targetClass); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取各图表类型界面ID, 本质是plotID |
||||||
|
* |
||||||
|
* @return 图表类型界面ID |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
protected String getPlotTypeID() { |
||||||
|
return VanChartBubblePlot.VAN_CHART_BUBBLE_PLOT_ID; |
||||||
|
} |
||||||
|
|
||||||
|
protected Plot getSelectedClonedPlot(){ |
||||||
|
VanChartBubblePlot newPlot = null; |
||||||
|
Chart[] bubbleChart = BubbleIndependentVanChart.BubbleVanChartTypes; |
||||||
|
for(int i = 0, len = bubbleChart.length; i < len; i++){ |
||||||
|
if(typeDemo.get(i).isPressing){ |
||||||
|
newPlot = (VanChartBubblePlot)bubbleChart[i].getPlot(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Plot cloned = null; |
||||||
|
try { |
||||||
|
cloned = (Plot)newPlot.clone(); |
||||||
|
} catch (CloneNotSupportedException e) { |
||||||
|
FRLogger.getLogger().error("Error In BubbleChart"); |
||||||
|
} |
||||||
|
return cloned; |
||||||
|
} |
||||||
|
|
||||||
|
public Chart getDefaultChart() { |
||||||
|
return BubbleIndependentVanChart.BubbleVanChartTypes[0]; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
/** |
||||||
|
* 力學氣泡圖切換到其他氣泡圖時,刪除條件屬性 |
||||||
|
* 并且将bubbleAttr属性重置 |
||||||
|
*/ |
||||||
|
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ |
||||||
|
cloneOldDefaultAttrConditionCollection(oldPlot, newPlot); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ |
||||||
|
if (oldPlot.getConditionCollection() != null) { |
||||||
|
ConditionCollection newCondition = new ConditionCollection(); |
||||||
|
newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone()); |
||||||
|
newPlot.setConditionCollection(newCondition); |
||||||
|
|
||||||
|
ConditionAttr attrList = newCondition.getDefaultAttr(); |
||||||
|
|
||||||
|
//根据气泡图类型,重设透明度属性
|
||||||
|
removeDefaultAttr(attrList, AttrAlpha.class); |
||||||
|
|
||||||
|
//删除标签属性(防止切换到大数据气泡图标签属性会拷贝过去)
|
||||||
|
removeDefaultAttr(attrList, ScatterAttrLabel.class); |
||||||
|
|
||||||
|
AttrAlpha attrAlpha = new AttrAlpha(); |
||||||
|
attrAlpha.setAlpha(((VanChartBubblePlot)newPlot).isForceBubble() ? FORCE_ALPHA : ALPHA); |
||||||
|
|
||||||
|
attrList.addDataSeriesCondition(attrAlpha); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void cloneHotHyperLink(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException { |
||||||
|
if(oldPlot instanceof VanChartBubblePlot && newPlot instanceof VanChartBubblePlot){ |
||||||
|
if(((VanChartBubblePlot) oldPlot).isForceBubble() == ((VanChartBubblePlot) newPlot).isForceBubble()){ |
||||||
|
super.cloneHotHyperLink(oldPlot, newPlot); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected VanChartTools createVanChartTools() { |
||||||
|
VanChartTools tools = new VanChartTools(); |
||||||
|
tools.setSort(false); |
||||||
|
return tools; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 气泡图相同图表类型之间切换的时候,chart的部分属性也需要重置 |
||||||
|
* @param chart |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
protected void resetChartAttr4SamePlot(Chart chart){ |
||||||
|
VanChartZoom vanChartZoom = new VanChartZoom(); |
||||||
|
((VanChart)chart).setVanChartZoom(vanChartZoom); |
||||||
|
//重置监控刷新选项
|
||||||
|
resetRefreshMoreLabelAttr((VanChart)chart); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,92 @@ |
|||||||
|
package com.fr.plugin.chart.bubble; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.chart.chartglyph.ConditionAttr; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; |
||||||
|
import com.fr.plugin.chart.bubble.component.VanChartBubblePane; |
||||||
|
import com.fr.plugin.chart.custom.component.VanChartCustomAxisConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||||
|
import com.fr.plugin.chart.designer.style.series.VanChartAbstractPlotSeriesPane; |
||||||
|
import com.fr.plugin.chart.designer.style.series.VanChartCustomStackAndAxisEditPane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/3/31. |
||||||
|
*/ |
||||||
|
public class VanChartBubbleSeriesPane extends VanChartAbstractPlotSeriesPane { |
||||||
|
private static final long serialVersionUID = 5595016643808487932L; |
||||||
|
private VanChartBubblePane bubblePane; |
||||||
|
|
||||||
|
public VanChartBubbleSeriesPane(ChartStylePane parent, Plot plot) { |
||||||
|
super(parent, plot); |
||||||
|
} |
||||||
|
|
||||||
|
protected JPanel getContentInPlotType() { |
||||||
|
|
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double[] row = {p, p, p, p, p, p}; |
||||||
|
double[] col = {f}; |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{createBubblePane()}, |
||||||
|
new Component[]{new JSeparator()}, |
||||||
|
new Component[]{createStackedAndAxisPane()}, |
||||||
|
new Component[]{createAlphaPane()}, |
||||||
|
new Component[]{new JSeparator()}, |
||||||
|
new Component[]{createLargeDataModelPane()} |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
contentPane = TableLayoutHelper.createTableLayoutPane(components, row, col); |
||||||
|
return contentPane; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
//堆积和坐标轴设置(自定义柱形图等用到)
|
||||||
|
protected JPanel createStackedAndAxisPane() { |
||||||
|
stackAndAxisEditPane = new VanChartCustomStackAndAxisEditPane(){ |
||||||
|
@Override |
||||||
|
protected Class<? extends BasicBeanPane> getStackAndAxisPaneClass() { |
||||||
|
return VanChartCustomAxisConditionPane.class; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String getPaneTitle(){ |
||||||
|
return Inter.getLocText("Plugin-ChartF_Custom_Axis"); |
||||||
|
} |
||||||
|
}; |
||||||
|
return stackAndAxisEditPane; |
||||||
|
} |
||||||
|
|
||||||
|
private JPanel createBubblePane() { |
||||||
|
bubblePane = new VanChartBubblePane(); |
||||||
|
return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("Plugin-ChartF_Bubble"), bubblePane); |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateCondition(ConditionAttr defaultAttr){ |
||||||
|
super.populateCondition(defaultAttr); |
||||||
|
if(bubblePane != null) { |
||||||
|
VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); |
||||||
|
bubblePane.populateBean(attrBubble); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void updateCondition(ConditionAttr defaultAttr){ |
||||||
|
super.updateCondition(defaultAttr); |
||||||
|
if(bubblePane != null){ |
||||||
|
VanChartAttrBubble attrBubble = (VanChartAttrBubble) defaultAttr.getExisted(VanChartAttrBubble.class); |
||||||
|
if (attrBubble != null) { |
||||||
|
defaultAttr.remove(attrBubble); |
||||||
|
} |
||||||
|
defaultAttr.addDataSeriesCondition(bubblePane.updateBean()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,57 @@ |
|||||||
|
package com.fr.plugin.chart.bubble; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||||
|
import com.fr.design.mainframe.chart.gui.style.series.ChartSeriesPane; |
||||||
|
import com.fr.plugin.chart.bubble.force.VanChartForceBubbleAreaPane; |
||||||
|
import com.fr.plugin.chart.bubble.force.VanChartForceBubbleLabelPane; |
||||||
|
import com.fr.plugin.chart.bubble.force.VanChartForceBubbleTooltipPane; |
||||||
|
import com.fr.plugin.chart.designer.style.background.VanChartAreaPane; |
||||||
|
import com.fr.plugin.chart.scatter.component.VanChartScatterStylePane; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/3/31. |
||||||
|
*/ |
||||||
|
public class VanChartBubbleStylePane extends VanChartScatterStylePane { |
||||||
|
|
||||||
|
public VanChartBubbleStylePane(AttributeChangeListener listener) { |
||||||
|
super(listener); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void createVanChartLabelPane(List<BasicPane> paneList) { |
||||||
|
Plot plot = getChart().getPlot(); |
||||||
|
|
||||||
|
if(((VanChartBubblePlot) plot).isForceBubble()){ |
||||||
|
paneList.add(new VanChartForceBubbleLabelPane(VanChartBubbleStylePane.this)); |
||||||
|
} else { |
||||||
|
super.createVanChartLabelPane(paneList); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void addVanChartTooltipPane(List<BasicPane> paneList){ |
||||||
|
Plot plot = getChart().getPlot(); |
||||||
|
if(((VanChartBubblePlot) plot).isForceBubble()){ |
||||||
|
paneList.add(new VanChartForceBubbleTooltipPane(VanChartBubbleStylePane.this)); |
||||||
|
} else { |
||||||
|
super.addVanChartTooltipPane(paneList); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void addVanChartAreaPane(List<BasicPane> paneList) { |
||||||
|
if (((VanChartBubblePlot)getChart().getPlot()).isForceBubble()){ |
||||||
|
paneList.add(new VanChartForceBubbleAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this)); |
||||||
|
}else { |
||||||
|
paneList.add(new VanChartAreaPane(getChart().getPlot(), VanChartBubbleStylePane.this)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected ChartSeriesPane createChartSeriesPane() { |
||||||
|
return new ChartSeriesPane(VanChartBubbleStylePane.this); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,74 @@ |
|||||||
|
package com.fr.plugin.chart.bubble.component; |
||||||
|
|
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.bubble.attr.VanChartAttrBubble; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/3/31. |
||||||
|
* 气泡大小等设置界面 |
||||||
|
*/ |
||||||
|
public class VanChartBubblePane extends BasicBeanPane<VanChartAttrBubble> { |
||||||
|
private UISpinner minDiameter; |
||||||
|
private UISpinner maxDiameter; |
||||||
|
private UIButtonGroup<Integer> shadow; |
||||||
|
private UIButtonGroup<Integer> displayNegative; |
||||||
|
|
||||||
|
public VanChartBubblePane(){ |
||||||
|
minDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); |
||||||
|
maxDiameter = new UISpinner(0,Double.MAX_VALUE,1,0); |
||||||
|
shadow = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_Open"), |
||||||
|
Inter.getLocText("Plugin-ChartF_Close")}); |
||||||
|
displayNegative = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_Open"), |
||||||
|
Inter.getLocText("Plugin-ChartF_Close")}); |
||||||
|
|
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double[] row = {p, p, p, p}; |
||||||
|
double[] col = {p, f}; |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_MinDiameter")), minDiameter}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_MaxDiameter")), maxDiameter}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Shadow")), shadow}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_DisplayNegative")), displayNegative}, |
||||||
|
|
||||||
|
}; |
||||||
|
JPanel content = TableLayoutHelper.createTableLayoutPane(components, row, col); |
||||||
|
|
||||||
|
this.setLayout(new BorderLayout()); |
||||||
|
this.add(content, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
public void populateBean(VanChartAttrBubble bubble) { |
||||||
|
if(bubble == null){ |
||||||
|
bubble = new VanChartAttrBubble(); |
||||||
|
} |
||||||
|
minDiameter.setValue(bubble.getMinDiameter()); |
||||||
|
maxDiameter.setValue(bubble.getMaxDiameter()); |
||||||
|
shadow.setSelectedIndex(bubble.isShadow() ? 0 : 1); |
||||||
|
displayNegative.setSelectedIndex(bubble.isDisplayNegative() ? 0 : 1); |
||||||
|
} |
||||||
|
|
||||||
|
public VanChartAttrBubble updateBean() { |
||||||
|
VanChartAttrBubble bubble = new VanChartAttrBubble(); |
||||||
|
bubble.setMinDiameter(minDiameter.getValue()); |
||||||
|
bubble.setMaxDiameter(maxDiameter.getValue()); |
||||||
|
bubble.setShadow(shadow.getSelectedIndex() == 0); |
||||||
|
bubble.setDisplayNegative(displayNegative.getSelectedIndex() == 0); |
||||||
|
return bubble; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_Bubble"); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,184 @@ |
|||||||
|
package com.fr.plugin.chart.bubble.data; |
||||||
|
|
||||||
|
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||||
|
import com.fr.chart.base.ChartConstants; |
||||||
|
import com.fr.chart.chartattr.BubblePlot; |
||||||
|
import com.fr.chart.chartattr.ChartCollection; |
||||||
|
import com.fr.chart.chartdata.BubbleTableDefinition; |
||||||
|
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
|
import com.fr.design.gui.ilable.BoldFontTextLabel; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.data.ChartDataFilterPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||||
|
import com.fr.general.ComparatorUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.ArrayUtils; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class VanChartBubblePlotTableDataContentPane extends AbstractTableDataContentPane { |
||||||
|
|
||||||
|
private static final Dimension PREFERRED_SIZE = new Dimension(100, 20); |
||||||
|
protected UIComboBox seriesName; |
||||||
|
protected UIComboBox xCombox; |
||||||
|
protected UIComboBox yCombox; |
||||||
|
protected UIComboBox bubbleSize; |
||||||
|
|
||||||
|
private ChartDataFilterPane dataScreeningPane; |
||||||
|
|
||||||
|
public VanChartBubblePlotTableDataContentPane(ChartDataPane parent) { |
||||||
|
seriesName = new UIComboBox(); |
||||||
|
xCombox = new UIComboBox(); |
||||||
|
yCombox = new UIComboBox(); |
||||||
|
|
||||||
|
dataScreeningPane = new ChartDataFilterPane(new BubblePlot(), parent); |
||||||
|
|
||||||
|
seriesName.setPreferredSize(PREFERRED_SIZE); |
||||||
|
xCombox.setPreferredSize(PREFERRED_SIZE); |
||||||
|
yCombox.setPreferredSize(PREFERRED_SIZE); |
||||||
|
|
||||||
|
seriesName.addItem(Inter.getLocText("Chart-Use_None")); |
||||||
|
|
||||||
|
initBubbleSize(); |
||||||
|
|
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double[] columnSize = {f}; |
||||||
|
double[] rowSize = { p, p,p,p}; |
||||||
|
|
||||||
|
double[] columnSize_north = {p, f}; |
||||||
|
double[] rowSize_north = {p, p, p, p}; |
||||||
|
|
||||||
|
Component[][] components_north = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Chart-Series_Name")+":", SwingConstants.RIGHT), seriesName}, |
||||||
|
new Component[]{new UILabel("x :", SwingConstants.RIGHT), xCombox}, |
||||||
|
new Component[]{new UILabel("y :", SwingConstants.RIGHT), yCombox}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Chart_Bubble_Size")+":", SwingConstants.RIGHT), bubbleSize}, |
||||||
|
}; |
||||||
|
|
||||||
|
JPanel north = TableLayoutHelper.createTableLayoutPane(components_north,rowSize_north,columnSize_north); |
||||||
|
north.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{north}, |
||||||
|
new Component[]{new JSeparator()}, |
||||||
|
new Component[]{new BoldFontTextLabel(Inter.getLocText("Chart-Data_Filter"))}, |
||||||
|
new Component[]{dataScreeningPane} |
||||||
|
}; |
||||||
|
|
||||||
|
|
||||||
|
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
|
this.setLayout(new BorderLayout()); |
||||||
|
this.add(panel, BorderLayout.CENTER); |
||||||
|
|
||||||
|
seriesName.addItemListener(tooltipListener); |
||||||
|
xCombox.addItemListener(tooltipListener); |
||||||
|
yCombox.addItemListener(tooltipListener); |
||||||
|
bubbleSize.addItemListener(tooltipListener); |
||||||
|
} |
||||||
|
|
||||||
|
protected void initBubbleSize() { |
||||||
|
bubbleSize = new UIComboBox(); |
||||||
|
bubbleSize.setPreferredSize(new Dimension(100, 20)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 检查box是否使用, donothing |
||||||
|
* @param hasUse 是否使用. |
||||||
|
*/ |
||||||
|
public void checkBoxUse(boolean hasUse) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
protected void refreshBoxListWithSelectTableData(List list) { |
||||||
|
refreshBoxItems(seriesName, list); |
||||||
|
seriesName.addItem(Inter.getLocText("Chart-Use_None")); |
||||||
|
refreshBoxItems(xCombox, list); |
||||||
|
refreshBoxItems(yCombox, list); |
||||||
|
refreshBoxItems(bubbleSize, list); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 清空所有的box设置 |
||||||
|
*/ |
||||||
|
public void clearAllBoxList(){ |
||||||
|
clearBoxItems(seriesName); |
||||||
|
seriesName.addItem(Inter.getLocText("Chart-Use_None")); |
||||||
|
clearBoxItems(xCombox); |
||||||
|
clearBoxItems(yCombox); |
||||||
|
clearBoxItems(bubbleSize); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(ChartCollection collection) { |
||||||
|
super.populateBean(collection); |
||||||
|
TopDefinitionProvider top = collection.getSelectedChart().getFilterDefinition(); |
||||||
|
if (!(top instanceof BubbleTableDefinition)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
BubbleTableDefinition definition = (BubbleTableDefinition) top; |
||||||
|
|
||||||
|
if(definition.getSeriesName() == null || ComparatorUtils.equals(StringUtils.EMPTY, definition.getSeriesName())) { |
||||||
|
seriesName.setSelectedItem(Inter.getLocText("Chart-Use_None")); |
||||||
|
} else { |
||||||
|
combineCustomEditValue(seriesName, definition.getSeriesName()); |
||||||
|
} |
||||||
|
|
||||||
|
combineCustomEditValue(xCombox, definition.getBubbleX()); |
||||||
|
combineCustomEditValue(yCombox, definition.getBubbleY()); |
||||||
|
//气泡图不配置“无”
|
||||||
|
populateBubbleSize(definition); |
||||||
|
|
||||||
|
dataScreeningPane.populateBean(collection); |
||||||
|
} |
||||||
|
|
||||||
|
protected void populateBubbleSize(BubbleTableDefinition definition) { |
||||||
|
if (ComparatorUtils.equals(definition.getBubbleSize(), Inter.getLocText("Chart-Use_None"))){ |
||||||
|
combineCustomEditValue(bubbleSize, StringUtils.EMPTY); |
||||||
|
}else { |
||||||
|
combineCustomEditValue(bubbleSize, definition.getBubbleSize()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void updateBean(ChartCollection collection) { |
||||||
|
BubbleTableDefinition definition = new BubbleTableDefinition(); |
||||||
|
collection.getSelectedChart().setFilterDefinition(definition); |
||||||
|
|
||||||
|
Object resultName = seriesName.getSelectedItem(); |
||||||
|
Object resultX = xCombox.getSelectedItem(); |
||||||
|
Object resultY = yCombox.getSelectedItem(); |
||||||
|
Object resultSize = bubbleSize.getSelectedItem(); |
||||||
|
|
||||||
|
if(resultName == null || ArrayUtils.contains(ChartConstants.getNoneKeys(), resultName)) { |
||||||
|
definition.setSeriesName(StringUtils.EMPTY); |
||||||
|
} else { |
||||||
|
definition.setSeriesName(resultName.toString()); |
||||||
|
} |
||||||
|
|
||||||
|
if (resultX != null) { |
||||||
|
definition.setBubbleX(resultX.toString()); |
||||||
|
} |
||||||
|
if (resultY != null) { |
||||||
|
definition.setBubbleY(resultY.toString()); |
||||||
|
} |
||||||
|
if (resultSize != null) { |
||||||
|
definition.setBubbleSize(resultSize.toString()); |
||||||
|
} |
||||||
|
|
||||||
|
dataScreeningPane.updateBean(collection); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 重新布局 |
||||||
|
*/ |
||||||
|
public void redoLayoutPane(){ |
||||||
|
dataScreeningPane.relayoutPane(this.isNeedSummaryCaculateMethod()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package com.fr.plugin.chart.bubble.force; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.plugin.chart.bubble.VanChartBubblePlot; |
||||||
|
import com.fr.plugin.chart.designer.component.VanChartRefreshTooltipContentPane; |
||||||
|
import com.fr.plugin.chart.designer.component.VanChartTooltipContentPane; |
||||||
|
import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotRefreshTooltipPane; |
||||||
|
import com.fr.plugin.chart.scatter.VanChartScatterRefreshTooltipContentPane; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by mengao on 2017/6/12. |
||||||
|
*/ |
||||||
|
public class VanChartBubbleRefreshTooltipPane extends VanChartPlotRefreshTooltipPane { |
||||||
|
|
||||||
|
public VanChartBubbleRefreshTooltipPane(Plot plot) { |
||||||
|
super(plot); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected VanChartTooltipContentPane getTooltipContentPane(Plot plot){ |
||||||
|
if (((VanChartBubblePlot)plot).isForceBubble()) { |
||||||
|
return new VanChartRefreshTooltipContentPane(parent, VanChartBubbleRefreshTooltipPane.this); |
||||||
|
} else { |
||||||
|
return new VanChartScatterRefreshTooltipContentPane(parent, VanChartBubbleRefreshTooltipPane.this); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,23 @@ |
|||||||
|
package com.fr.plugin.chart.bubble.force; |
||||||
|
|
||||||
|
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||||
|
import com.fr.plugin.chart.designer.style.background.VanChartAreaBackgroundPane; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
//图表区|绘图区 边框和背景
|
||||||
|
public class VanChartForceBubbleAreaBackgroundPane extends VanChartAreaBackgroundPane { |
||||||
|
|
||||||
|
|
||||||
|
public VanChartForceBubbleAreaBackgroundPane(boolean isPlot, AbstractAttrNoScrollPane parent) { |
||||||
|
super(isPlot, parent); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected Component[][] initComponents() { |
||||||
|
return new Component[][]{ |
||||||
|
new Component[]{chartBorderPane}, |
||||||
|
new Component[]{chartBackgroundPane}, |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package com.fr.plugin.chart.bubble.force; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
|
||||||
|
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||||
|
|
||||||
|
|
||||||
|
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||||
|
|
||||||
|
import com.fr.plugin.chart.designer.style.background.VanChartAreaPane; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 属性表, 图表样式-背景界面. |
||||||
|
*/ |
||||||
|
public class VanChartForceBubbleAreaPane extends VanChartAreaPane { |
||||||
|
|
||||||
|
public VanChartForceBubbleAreaPane(Plot plot, VanChartStylePane parent) { |
||||||
|
super(plot, parent); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initPlotPane(boolean b, AbstractAttrNoScrollPane parent) { |
||||||
|
plotPane = new VanChartForceBubbleAreaBackgroundPane(true, parent); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package com.fr.plugin.chart.bubble.force; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||||
|
import com.fr.plugin.chart.designer.style.label.VanChartLabelPane; |
||||||
|
import com.fr.plugin.chart.designer.style.label.VanChartPlotLabelPane; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/3/31. |
||||||
|
*/ |
||||||
|
public class VanChartForceBubbleLabelPane extends VanChartLabelPane { |
||||||
|
public VanChartForceBubbleLabelPane(VanChartStylePane parent) { |
||||||
|
super(parent); |
||||||
|
} |
||||||
|
|
||||||
|
protected VanChartPlotLabelPane getLabelPane(Plot plot) { |
||||||
|
return new VanChartPlotLabelPane(plot, parent); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.fr.plugin.chart.bubble.force; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||||
|
import com.fr.plugin.chart.designer.style.tooltip.VanChartPlotTooltipPane; |
||||||
|
import com.fr.plugin.chart.designer.style.tooltip.VanChartTooltipPane; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/3/31. |
||||||
|
*/ |
||||||
|
public class VanChartForceBubbleTooltipPane extends VanChartTooltipPane { |
||||||
|
public VanChartForceBubbleTooltipPane(VanChartStylePane parent) { |
||||||
|
super(parent); |
||||||
|
} |
||||||
|
protected VanChartPlotTooltipPane getTooltipPane(Plot plot) { |
||||||
|
return new VanChartPlotTooltipPane(plot, parent); |
||||||
|
} |
||||||
|
} |
After Width: | Height: | Size: 693 B |
After Width: | Height: | Size: 772 B |
After Width: | Height: | Size: 832 B |
@ -0,0 +1,43 @@ |
|||||||
|
package com.fr.plugin.chart.column; |
||||||
|
|
||||||
|
import com.fr.design.chart.comp.BorderAttriPane; |
||||||
|
import com.fr.design.gui.icombobox.LineComboBox; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
|
import com.fr.design.style.color.ColorSelectBox; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
import com.fr.stable.CoreConstants; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by hufan on 2016/8/11. |
||||||
|
*/ |
||||||
|
public class ColumnBorderAttriPane extends BorderAttriPane { |
||||||
|
private UISpinner radius; |
||||||
|
|
||||||
|
public ColumnBorderAttriPane() { |
||||||
|
this(Inter.getLocText("plugin-ChartF_Radius")); |
||||||
|
} |
||||||
|
|
||||||
|
public ColumnBorderAttriPane(String radiusString) { |
||||||
|
this.add(new UILabel(radiusString + ":")); |
||||||
|
radius = new UISpinner(0,1000,1,0); |
||||||
|
this.add(radius); |
||||||
|
radius.setPreferredSize(new Dimension(60, 18)); |
||||||
|
} |
||||||
|
|
||||||
|
public void setRadius(int value) { |
||||||
|
this.radius.setValue(value); |
||||||
|
} |
||||||
|
|
||||||
|
public double getRadius() { |
||||||
|
return this.radius.getValue(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return "Border"; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.fr.plugin.chart.column; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.condition.ConditionAttributesPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||||
|
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||||
|
import com.fr.plugin.chart.vanchart.AbstractMultiCategoryVanChartUI; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 15/9/24. |
||||||
|
*/ |
||||||
|
public class ColumnIndependentVanChartInterface extends AbstractMultiCategoryVanChartUI { |
||||||
|
@Override |
||||||
|
public String getIconPath() { |
||||||
|
return "com/fr/design/images/form/toolbar/column.png"; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public AbstractChartTypePane getPlotTypePane() { |
||||||
|
return new VanChartColumnPlotPane(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public ConditionAttributesPane getPlotConditionPane(Plot plot){ |
||||||
|
return new VanChartColumnConditionPane(plot); |
||||||
|
} |
||||||
|
|
||||||
|
public BasicBeanPane<Plot> getPlotSeriesPane(ChartStylePane parent, Plot plot){ |
||||||
|
return new VanChartColumnSeriesPane(parent, plot); |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlotTypeTitle4PopupWindow(){ |
||||||
|
return VanChartColumnPlotPane.TITLE; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
package com.fr.plugin.chart.column; |
||||||
|
|
||||||
|
import com.fr.chart.base.AttrAlpha; |
||||||
|
import com.fr.chart.base.AttrBackground; |
||||||
|
import com.fr.chart.base.AttrBorder; |
||||||
|
import com.fr.chart.base.ChartConstants; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.chart.series.SeriesCondition.ChartConditionPane; |
||||||
|
import com.fr.design.chart.series.SeriesCondition.DataSeriesConditionPane; |
||||||
|
import com.fr.design.chart.series.SeriesCondition.LabelAlphaPane; |
||||||
|
import com.fr.plugin.chart.attr.EffectHelper; |
||||||
|
import com.fr.plugin.chart.base.AttrDataSheet; |
||||||
|
import com.fr.plugin.chart.base.AttrEffect; |
||||||
|
import com.fr.plugin.chart.base.AttrFloatColor; |
||||||
|
import com.fr.plugin.chart.base.AttrLabel; |
||||||
|
import com.fr.plugin.chart.base.AttrSeriesImageBackground; |
||||||
|
import com.fr.plugin.chart.base.AttrTooltip; |
||||||
|
import com.fr.plugin.chart.base.VanChartAttrTrendLine; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartDataSheetContentPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartEffectConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartFloatColorConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartLabelConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesColorConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartSeriesImageBackgroundConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartTooltipConditionPane; |
||||||
|
import com.fr.plugin.chart.designer.other.condition.item.VanChartTrendLineConditionPane; |
||||||
|
import com.fr.plugin.chart.glyph.VanChartMultiCategoryDataPoint; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 15/9/28. |
||||||
|
*/ |
||||||
|
public class VanChartColumnConditionPane extends DataSeriesConditionPane{ |
||||||
|
private static final long serialVersionUID = -7180705321732069806L; |
||||||
|
|
||||||
|
public VanChartColumnConditionPane(Plot plot) { |
||||||
|
super(plot); |
||||||
|
} |
||||||
|
|
||||||
|
protected void initComponents() { |
||||||
|
super.initComponents(); |
||||||
|
//添加全部条件属性后被遮挡
|
||||||
|
liteConditionPane.setPreferredSize(new Dimension(300, 400)); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void addBasicAction() { |
||||||
|
classPaneMap.put(AttrBackground.class, new VanChartSeriesColorConditionPane(this)); |
||||||
|
classPaneMap.put(AttrAlpha.class, new LabelAlphaPane(this)); |
||||||
|
classPaneMap.put(AttrBorder.class, new VanChartColumnLabelBorderPane(this)); |
||||||
|
classPaneMap.put(AttrLabel.class, new VanChartLabelConditionPane(this, plot)); |
||||||
|
classPaneMap.put(AttrFloatColor.class, new VanChartFloatColorConditionPane(this)); |
||||||
|
classPaneMap.put(VanChartAttrTrendLine.class, new VanChartTrendLineConditionPane(this)); |
||||||
|
classPaneMap.put(AttrSeriesImageBackground.class, new VanChartSeriesImageBackgroundConditionPane(this)); |
||||||
|
classPaneMap.put(AttrEffect.class, new VanChartEffectConditionPane(this, EffectHelper.getColumnPlotDefaultEffect())); |
||||||
|
classPaneMap.put(AttrTooltip.class, new VanChartTooltipConditionPane(this, plot)); |
||||||
|
//是否使用数据表
|
||||||
|
//自定义柱形图设置多X坐标轴时,不支持数据表
|
||||||
|
if (plot.getDataSheet().isVisible() && ((VanChartColumnPlot) plot).getXAxisList().size() == 1) { |
||||||
|
classPaneMap.put(AttrDataSheet.class, new VanChartDataSheetContentPane(this, plot)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected void addStyleAction() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected ChartConditionPane createListConditionPane() { |
||||||
|
return new ChartConditionPane(){ |
||||||
|
@Override |
||||||
|
public String[] columns2Populate() { |
||||||
|
return new String[]{ |
||||||
|
ChartConstants.CATEGORY_INDEX, |
||||||
|
ChartConstants.CATEGORY_NAME, |
||||||
|
ChartConstants.SERIES_INDEX, |
||||||
|
ChartConstants.SERIES_NAME, |
||||||
|
ChartConstants.VALUE, |
||||||
|
VanChartMultiCategoryDataPoint.CATEGORY_ARRAY, |
||||||
|
}; |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回图表class对象 |
||||||
|
* @return class对象 |
||||||
|
*/ |
||||||
|
public Class<? extends Plot> class4Correspond() { |
||||||
|
return VanChartColumnPlot.class; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
package com.fr.plugin.chart.column; |
||||||
|
import com.fr.chart.base.AttrBorder; |
||||||
|
import com.fr.chart.base.DataSeriesCondition; |
||||||
|
import com.fr.design.chart.comp.BorderAttriPane; |
||||||
|
import com.fr.design.chart.series.SeriesCondition.LabelBorderPane; |
||||||
|
import com.fr.design.condition.ConditionAttributesPane; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by hufan on 2016/8/11. |
||||||
|
*/ |
||||||
|
public class VanChartColumnLabelBorderPane extends LabelBorderPane { |
||||||
|
public VanChartColumnLabelBorderPane(ConditionAttributesPane conditionAttributesPane) { |
||||||
|
super(conditionAttributesPane); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected BorderAttriPane initBorderAttrPane(){ |
||||||
|
return new ColumnBorderAttriPane(); |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(DataSeriesCondition condition) { |
||||||
|
super.populate(condition); |
||||||
|
if (condition instanceof AttrBorder) { |
||||||
|
((ColumnBorderAttriPane)linePane).setRadius(attrBorder.getRoundRadius()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public DataSeriesCondition update() { |
||||||
|
super.update(); |
||||||
|
attrBorder.setRoundRadius((int) ((ColumnBorderAttriPane)linePane).getRadius()); |
||||||
|
attrBorder.setRoundBorder(true); |
||||||
|
return attrBorder; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,96 @@ |
|||||||
|
package com.fr.plugin.chart.column; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Chart; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; |
||||||
|
import com.fr.general.FRLogger; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 15/9/24. |
||||||
|
*/ |
||||||
|
public class VanChartColumnPlotPane extends AbstractVanChartTypePane { |
||||||
|
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewColumn"); |
||||||
|
|
||||||
|
private static final long serialVersionUID = 5950923001789733745L; |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected String[] getTypeIconPath() { |
||||||
|
return new String[]{"/com/fr/plugin/chart/column/images/column.png", |
||||||
|
"/com/fr/plugin/chart/column/images/stack.png", |
||||||
|
"/com/fr/plugin/chart/column/images/percentstack.png", |
||||||
|
"/com/fr/plugin/chart/column/images/custom.png", |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String[] getTypeTipName() { |
||||||
|
String column = Inter.getLocText("FR-Chart-Type_Column"); |
||||||
|
String stack = Inter.getLocText("FR-Chart-Type_Stacked"); |
||||||
|
String percent = Inter.getLocText("FR-Chart-Use_Percent"); |
||||||
|
return new String[]{ |
||||||
|
column, |
||||||
|
stack + column, |
||||||
|
percent + stack + column, |
||||||
|
Inter.getLocText("FR-Chart-Mode_Custom") |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回界面标题 |
||||||
|
* @return 界面标题 |
||||||
|
*/ |
||||||
|
public String title4PopupWindow() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_NewColumn"); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新界面内容 |
||||||
|
*/ |
||||||
|
public void populateBean(Chart chart) { |
||||||
|
for(ChartImagePane imagePane : typeDemo) { |
||||||
|
imagePane.isPressing = false; |
||||||
|
} |
||||||
|
Plot plot = chart.getPlot(); |
||||||
|
if(plot instanceof VanChartColumnPlot) { |
||||||
|
lastTypeIndex = ((VanChartColumnPlot)plot).getVanChartPlotType().ordinal(); |
||||||
|
typeDemo.get(lastTypeIndex).isPressing = true; |
||||||
|
} |
||||||
|
checkDemosBackground(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取各图表类型界面ID, 本质是plotID |
||||||
|
* |
||||||
|
* @return 图表类型界面ID |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
protected String getPlotTypeID() { |
||||||
|
return VanChartColumnPlot.VAN_CHART_COLUMN_PLOT_ID; |
||||||
|
} |
||||||
|
|
||||||
|
protected Plot getSelectedClonedPlot(){ |
||||||
|
VanChartColumnPlot newPlot = null; |
||||||
|
Chart[] columnChart = ColumnIndependentVanChart.ColumnVanChartTypes; |
||||||
|
for(int i = 0, len = columnChart.length; i < len; i++){ |
||||||
|
if(typeDemo.get(i).isPressing){ |
||||||
|
newPlot = (VanChartColumnPlot)columnChart[i].getPlot(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Plot cloned = null; |
||||||
|
try { |
||||||
|
cloned = (Plot)newPlot.clone(); |
||||||
|
} catch (CloneNotSupportedException e) { |
||||||
|
FRLogger.getLogger().error("Error In ColumnChart"); |
||||||
|
} |
||||||
|
return cloned; |
||||||
|
} |
||||||
|
|
||||||
|
public Chart getDefaultChart() { |
||||||
|
return ColumnIndependentVanChart.ColumnVanChartTypes[0]; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,194 @@ |
|||||||
|
package com.fr.plugin.chart.column; |
||||||
|
|
||||||
|
import com.fr.base.background.ImageBackground; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.chart.chartglyph.ConditionAttr; |
||||||
|
import com.fr.design.gui.frpane.UINumberDragPane; |
||||||
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.ispinner.UISpinner; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartStylePane; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.base.AttrSeriesImageBackground; |
||||||
|
import com.fr.plugin.chart.designer.TableLayout4VanChartHelper; |
||||||
|
import com.fr.plugin.chart.designer.component.border.VanChartBorderPane; |
||||||
|
import com.fr.plugin.chart.designer.component.border.VanChartBorderWithRadiusPane; |
||||||
|
import com.fr.plugin.chart.designer.style.series.VanChartAbstractPlotSeriesPane; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
|
||||||
|
/** |
||||||
|
* 新条形图系列界面 |
||||||
|
*/ |
||||||
|
public class VanChartColumnSeriesPane extends VanChartAbstractPlotSeriesPane { |
||||||
|
|
||||||
|
private static final long serialVersionUID = -8875943419420081420L; |
||||||
|
private UIButtonGroup<Integer> isFixedWidth;//是否固定宽度
|
||||||
|
private UISpinner columnWidth;//宽度
|
||||||
|
|
||||||
|
private UINumberDragPane categoryGap;//分类间隔
|
||||||
|
private UINumberDragPane seriesGap;//系列间隔
|
||||||
|
private UIButtonGroup<Integer> isFillWithImage;//是否使用图片填充
|
||||||
|
private ImageBackgroundQuickPane imagePane;//填充图片选择界面
|
||||||
|
|
||||||
|
public VanChartColumnSeriesPane(ChartStylePane parent, Plot plot) { |
||||||
|
super(parent, plot); |
||||||
|
} |
||||||
|
|
||||||
|
protected JPanel getContentInPlotType() { |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
double[] columnSize = {f}; |
||||||
|
double[] rowSize = {p,p,p,p,p,p,p,p,p,p}; |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{createStylePane()}, |
||||||
|
new Component[]{stylePane == null ? null : new JSeparator()}, |
||||||
|
new Component[]{createSeriesStylePane(new double[]{p,p}, new double[]{p,f})}, |
||||||
|
new Component[]{new JSeparator()}, |
||||||
|
new Component[]{createBorderPane()}, |
||||||
|
new Component[]{createStackedAndAxisPane()}, |
||||||
|
new Component[]{createTrendLinePane()}, |
||||||
|
}; |
||||||
|
|
||||||
|
contentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
|
|
||||||
|
return contentPane; |
||||||
|
} |
||||||
|
|
||||||
|
//边框(有圆角)
|
||||||
|
protected VanChartBorderPane createDiffBorderPane() { |
||||||
|
return new VanChartBorderWithRadiusPane(); |
||||||
|
} |
||||||
|
|
||||||
|
private JPanel createSeriesStylePane(double[] row, double[] col) { |
||||||
|
isFixedWidth = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); |
||||||
|
columnWidth = new UISpinner(0,1000,1,0); |
||||||
|
seriesGap = new UINumberDragPane(-100, 100); |
||||||
|
categoryGap = new UINumberDragPane(0, 100); |
||||||
|
isFillWithImage = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); |
||||||
|
imagePane = new ImageBackgroundQuickPane(false); |
||||||
|
|
||||||
|
Component[][] components1 = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Fixed_Column_Width")),isFixedWidth}, |
||||||
|
new Component[]{null,columnWidth}, |
||||||
|
}; |
||||||
|
JPanel panel1 = TableLayoutHelper.createTableLayoutPane(components1, row, col); |
||||||
|
|
||||||
|
Component[][] components2 = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Gap_Series")),seriesGap}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Gap_Category")),categoryGap}, |
||||||
|
}; |
||||||
|
JPanel panel2 = TableLayoutHelper.createTableLayoutPane(components2, row, col); |
||||||
|
|
||||||
|
Component[][] components3 = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_Filled_With_Image")),isFillWithImage}, |
||||||
|
}; |
||||||
|
JPanel panel3 = TableLayoutHelper.createTableLayoutPane(components3, row, col); |
||||||
|
|
||||||
|
JPanel panel = new JPanel(new BorderLayout(0, 4)); |
||||||
|
panel.add(panel1, BorderLayout.NORTH); |
||||||
|
panel.add(panel2, BorderLayout.CENTER); |
||||||
|
panel.add(panel3, BorderLayout.SOUTH); |
||||||
|
|
||||||
|
JPanel borderPane = new JPanel(new BorderLayout()); |
||||||
|
borderPane.add(panel, BorderLayout.NORTH); |
||||||
|
borderPane.add(imagePane, BorderLayout.CENTER); |
||||||
|
isFixedWidth.addActionListener(new ActionListener() { |
||||||
|
@Override |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
checkColumnWidth(); |
||||||
|
} |
||||||
|
}); |
||||||
|
isFillWithImage.addActionListener(new ActionListener() { |
||||||
|
@Override |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
checkImagePane(); |
||||||
|
} |
||||||
|
}); |
||||||
|
return TableLayout4VanChartHelper.createTableLayoutPaneWithTitle(Inter.getLocText("FR-Designer-Widget_Style"), borderPane); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkAll() { |
||||||
|
checkColumnWidth(); |
||||||
|
checkImagePane(); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkColumnWidth() { |
||||||
|
columnWidth.setEnabled(isFixedWidth.getSelectedIndex() == 0); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkImagePane() { |
||||||
|
GUICoreUtils.setEnabled(imagePane, isFillWithImage.getSelectedIndex() == 0); |
||||||
|
} |
||||||
|
|
||||||
|
public void populateBean(Plot plot) { |
||||||
|
if(plot == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
super.populateBean(plot); |
||||||
|
|
||||||
|
if(plot instanceof VanChartColumnPlot){ |
||||||
|
VanChartColumnPlot columnPlot4VanChart = (VanChartColumnPlot)plot; |
||||||
|
|
||||||
|
isFixedWidth.setSelectedIndex(columnPlot4VanChart.isFixedWidth() ? 0 : 1); |
||||||
|
columnWidth.setValue(columnPlot4VanChart.getColumnWidth()); |
||||||
|
categoryGap.populateBean(columnPlot4VanChart.getCategoryIntervalPercent()); |
||||||
|
seriesGap.populateBean(columnPlot4VanChart.getSeriesOverlapPercent()); |
||||||
|
isFillWithImage.setSelectedIndex(columnPlot4VanChart.isFilledWithImage() ? 0 : 1); |
||||||
|
ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); |
||||||
|
|
||||||
|
if(columnPlot4VanChart.isFilledWithImage()){ |
||||||
|
AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class); |
||||||
|
if(attrSeriesImageBackground != null){ |
||||||
|
imagePane.populateBean(attrSeriesImageBackground.getSeriesBackground()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
checkAll(); |
||||||
|
} |
||||||
|
|
||||||
|
public void updateBean(Plot plot) { |
||||||
|
if(plot == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
super.updateBean(plot); |
||||||
|
|
||||||
|
if(plot instanceof VanChartColumnPlot){ |
||||||
|
VanChartColumnPlot columnPlot4VanChart = (VanChartColumnPlot)plot; |
||||||
|
|
||||||
|
columnPlot4VanChart.setFixedWidth(isFixedWidth.getSelectedIndex() == 0); |
||||||
|
columnPlot4VanChart.setColumnWidth((int)columnWidth.getValue()); |
||||||
|
columnPlot4VanChart.setCategoryIntervalPercent(categoryGap.updateBean()); |
||||||
|
columnPlot4VanChart.setSeriesOverlapPercent(seriesGap.updateBean()); |
||||||
|
columnPlot4VanChart.setFilledWithImage(isFillWithImage.getSelectedIndex() == 0); |
||||||
|
ConditionAttr defaultAttr = plot.getConditionCollection().getDefaultAttr(); |
||||||
|
if(isFillWithImage.getSelectedIndex() == 0){ |
||||||
|
AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class); |
||||||
|
if(attrSeriesImageBackground == null){ |
||||||
|
attrSeriesImageBackground = new AttrSeriesImageBackground(); |
||||||
|
defaultAttr.addDataSeriesCondition(attrSeriesImageBackground); |
||||||
|
} |
||||||
|
attrSeriesImageBackground.setSeriesBackground(imagePane.updateBean()); |
||||||
|
//设置背景图片平铺方式
|
||||||
|
ImageBackground imageBackground = (ImageBackground) attrSeriesImageBackground.getSeriesBackground(); |
||||||
|
if (imageBackground != null){ |
||||||
|
imageBackground.setLayout(Constants.IMAGE_TILED); |
||||||
|
} |
||||||
|
|
||||||
|
} else { |
||||||
|
AttrSeriesImageBackground attrSeriesImageBackground = (AttrSeriesImageBackground)defaultAttr.getExisted(AttrSeriesImageBackground.class); |
||||||
|
if(attrSeriesImageBackground != null){ |
||||||
|
defaultAttr.remove(attrSeriesImageBackground); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,143 @@ |
|||||||
|
package com.fr.plugin.chart.column; |
||||||
|
|
||||||
|
import com.fr.chart.chartglyph.ConditionAttr; |
||||||
|
import com.fr.data.condition.AbstractCondition; |
||||||
|
import com.fr.data.condition.ListCondition; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.condition.LiteConditionPane; |
||||||
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
|
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.base.AttrSeriesStackAndAxis; |
||||||
|
import com.fr.plugin.chart.designer.style.series.VanChartSeriesConditionPane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
|
||||||
|
/** |
||||||
|
* 堆积和坐标轴设置 |
||||||
|
*/ |
||||||
|
public class VanChartCustomStackAndAxisConditionPane extends BasicBeanPane<ConditionAttr> { |
||||||
|
private static final long serialVersionUID = 2713124322060048526L; |
||||||
|
|
||||||
|
protected UIButtonGroup<Integer> XAxis; |
||||||
|
protected UIButtonGroup<Integer> YAxis; |
||||||
|
protected UIButtonGroup<Integer> isStacked; |
||||||
|
protected UIButtonGroup<Integer> isPercentStacked; |
||||||
|
|
||||||
|
private LiteConditionPane liteConditionPane; |
||||||
|
|
||||||
|
public VanChartCustomStackAndAxisConditionPane(){ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void doLayoutPane(){ |
||||||
|
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
||||||
|
|
||||||
|
//配置界面
|
||||||
|
JPanel deployPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||||
|
this.add(deployPane); |
||||||
|
|
||||||
|
deployPane.setBorder(GUICoreUtils.createTitledBorder(Inter.getLocText("Plugin-ChartF_Deploy") + ":", null)); |
||||||
|
deployPane.add(createDeployPane()); |
||||||
|
|
||||||
|
//条件界面
|
||||||
|
JPanel conditionPane = FRGUIPaneFactory.createBorderLayout_L_Pane(); |
||||||
|
this.add(conditionPane); |
||||||
|
conditionPane.setBorder(BorderFactory.createEmptyBorder()); |
||||||
|
|
||||||
|
conditionPane.add(liteConditionPane = new VanChartSeriesConditionPane()); |
||||||
|
liteConditionPane.setPreferredSize(new Dimension(300, 300)); |
||||||
|
} |
||||||
|
|
||||||
|
private JPanel createDeployPane() |
||||||
|
{ |
||||||
|
isStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); |
||||||
|
isPercentStacked = new UIButtonGroup<Integer>(new String[]{Inter.getLocText("Plugin-ChartF_YES"), Inter.getLocText("Plugin-ChartF_NO")}); |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double[] columnSize = {p,p}; |
||||||
|
double[] rowSize = {p,p,p,p}; |
||||||
|
|
||||||
|
return TableLayoutHelper.createTableLayoutPane(getDeployComponents(), rowSize, columnSize); |
||||||
|
} |
||||||
|
|
||||||
|
protected Component[][] getDeployComponents() { |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("ChartF-X_Axis")),XAxis}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("ChartF-Y_Axis")),YAxis}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Chart-Type_Stacked")),isStacked}, |
||||||
|
new Component[]{new UILabel(Inter.getLocText("Plugin-ChartF_PercentStacked")),isPercentStacked}, |
||||||
|
}; |
||||||
|
|
||||||
|
isStacked.addActionListener(new ActionListener() { |
||||||
|
@Override |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
checkBox(); |
||||||
|
} |
||||||
|
}); |
||||||
|
return components; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_StackAndSeries"); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkBox() { |
||||||
|
isPercentStacked.setEnabled(isStacked.getSelectedIndex() == 0); |
||||||
|
} |
||||||
|
|
||||||
|
public void populateBean(ConditionAttr conditionAttr){ |
||||||
|
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis)conditionAttr.getExisted(AttrSeriesStackAndAxis.class); |
||||||
|
XAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getXAxisNamesArray()); |
||||||
|
YAxis = new UIButtonGroup<Integer>(seriesStackAndAxis.getYAxisNameArray()); |
||||||
|
|
||||||
|
doLayoutPane(); |
||||||
|
XAxis.setSelectedIndex(seriesStackAndAxis.getXAxisIndex()); |
||||||
|
YAxis.setSelectedIndex(seriesStackAndAxis.getYAxisIndex()); |
||||||
|
isStacked.setSelectedIndex(seriesStackAndAxis.isStacked() ? 0 : 1); |
||||||
|
isPercentStacked.setSelectedIndex(seriesStackAndAxis.isPercentStacked() ? 0 : 1); |
||||||
|
|
||||||
|
if (conditionAttr.getCondition() == null) { |
||||||
|
this.liteConditionPane.populateBean(new ListCondition()); |
||||||
|
} else { |
||||||
|
this.liteConditionPane.populateBean(conditionAttr.getCondition()); |
||||||
|
} |
||||||
|
|
||||||
|
checkBox(); |
||||||
|
} |
||||||
|
|
||||||
|
public void updateBean(ConditionAttr conditionAttr){ |
||||||
|
AttrSeriesStackAndAxis seriesStackAndAxis = (AttrSeriesStackAndAxis)conditionAttr.getExisted(AttrSeriesStackAndAxis.class); |
||||||
|
|
||||||
|
seriesStackAndAxis.setXAxisIndex(XAxis.getSelectedIndex()); |
||||||
|
seriesStackAndAxis.setYAxisIndex(YAxis.getSelectedIndex()); |
||||||
|
|
||||||
|
updateStackAndPercent(seriesStackAndAxis); |
||||||
|
|
||||||
|
AbstractCondition con = (AbstractCondition) this.liteConditionPane.updateBean(); |
||||||
|
conditionAttr.setCondition(con); |
||||||
|
} |
||||||
|
|
||||||
|
protected void updateStackAndPercent(AttrSeriesStackAndAxis seriesStackAndAxis) { |
||||||
|
seriesStackAndAxis.setStacked(isStacked.getSelectedIndex() == 0); |
||||||
|
if(seriesStackAndAxis.isStacked()){ |
||||||
|
seriesStackAndAxis.setPercentStacked(isPercentStacked.getSelectedIndex() == 0); |
||||||
|
} else { |
||||||
|
seriesStackAndAxis.setPercentStacked(false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public ConditionAttr updateBean(){ |
||||||
|
ConditionAttr conditionAttr = new ConditionAttr(); |
||||||
|
updateBean(conditionAttr); |
||||||
|
return conditionAttr; |
||||||
|
} |
||||||
|
|
||||||
|
} |
After Width: | Height: | Size: 304 B |
After Width: | Height: | Size: 296 B |
After Width: | Height: | Size: 288 B |
After Width: | Height: | Size: 300 B |
@ -0,0 +1,56 @@ |
|||||||
|
package com.fr.plugin.chart.custom; |
||||||
|
|
||||||
|
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.type.AbstractChartTypePane; |
||||||
|
import com.fr.plugin.chart.custom.other.VanChartCustomOtherPane; |
||||||
|
import com.fr.plugin.chart.custom.style.VanChartCustomStylePane; |
||||||
|
import com.fr.plugin.chart.designer.other.VanChartOtherPane; |
||||||
|
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||||
|
import com.fr.plugin.chart.vanchart.AbstractIndependentVanChartUI; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/2/16. |
||||||
|
*/ |
||||||
|
public class CustomIndependentVanChartInterface extends AbstractIndependentVanChartUI { |
||||||
|
/** |
||||||
|
* 图表的类型定义界面类型,就是属性表的第一个界面 |
||||||
|
* |
||||||
|
* @return 图表的类型定义界面类型 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public AbstractChartTypePane getPlotTypePane() { |
||||||
|
return new VanChartCustomPlotPane(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 图标路径 |
||||||
|
* |
||||||
|
* @return 图标路径 |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
public String getIconPath() { |
||||||
|
return "com/fr/design/images/form/toolbar/custom.png"; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
/** |
||||||
|
* 图表的属性界面数组 |
||||||
|
* @return 属性界面 |
||||||
|
*/ |
||||||
|
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener listener){ |
||||||
|
VanChartStylePane stylePane = new VanChartCustomStylePane(listener); |
||||||
|
VanChartOtherPane otherPane = new VanChartCustomOtherPane(); |
||||||
|
return new AbstractChartAttrPane[]{stylePane, otherPane}; |
||||||
|
} |
||||||
|
|
||||||
|
public ChartDataPane getChartDataPane(AttributeChangeListener listener){ |
||||||
|
return new VanChartCustomDataPane(listener); |
||||||
|
} |
||||||
|
|
||||||
|
public String getPlotTypeTitle4PopupWindow(){ |
||||||
|
return VanChartCustomPlotPane.TITLE; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,134 @@ |
|||||||
|
package com.fr.plugin.chart.custom; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; |
||||||
|
import com.fr.general.FRLogger; |
||||||
|
import com.fr.plugin.chart.PiePlot4VanChart; |
||||||
|
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; |
||||||
|
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||||
|
import com.fr.plugin.chart.bubble.VanChartBubblePlot; |
||||||
|
import com.fr.plugin.chart.custom.CustomPlotFactory; |
||||||
|
import com.fr.plugin.chart.custom.component.CustomPlotLocationPane; |
||||||
|
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||||
|
import com.fr.plugin.chart.bubble.data.VanChartBubblePlotTableDataContentPane; |
||||||
|
import com.fr.plugin.chart.scatter.data.VanChartScatterPlotTableDataContentPane; |
||||||
|
import com.fr.plugin.chart.designer.style.VanChartStylePane; |
||||||
|
import com.fr.plugin.chart.designer.style.axis.VanChartAxisPane; |
||||||
|
import com.fr.plugin.chart.designer.style.axis.gauge.VanChartGaugeAxisPane; |
||||||
|
import com.fr.plugin.chart.gauge.VanChartGaugePlot; |
||||||
|
import com.fr.plugin.chart.radar.VanChartRadarPlot; |
||||||
|
import com.fr.plugin.chart.scatter.VanChartScatterPlot; |
||||||
|
|
||||||
|
import java.lang.reflect.Constructor; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/6/23. |
||||||
|
*/ |
||||||
|
public class CustomPlotDesignerPaneFactory { |
||||||
|
|
||||||
|
//图表类型对应数据配置界面
|
||||||
|
private static Map<Class<? extends Plot>, Class<? extends AbstractTableDataContentPane>> plotTableDataContentPaneMap = new HashMap<Class<? extends Plot>, Class<? extends AbstractTableDataContentPane>>(); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//图表类型对应的位置面板
|
||||||
|
private static Map<Class<? extends Plot>, Class<? extends BasicBeanPane<Plot>>> plotPositionMap = new HashMap<Class<? extends Plot>, Class<? extends BasicBeanPane<Plot>>>(); |
||||||
|
|
||||||
|
static { |
||||||
|
plotPositionMap.put(PiePlot4VanChart.class, CustomPlotLocationPane.class); |
||||||
|
plotPositionMap.put(VanChartRadarPlot.class, CustomPlotLocationPane.class); |
||||||
|
plotPositionMap.put(VanChartGaugePlot.class, CustomPlotLocationPane.class); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据图表类型创建位置面板 |
||||||
|
* @param plot 图表 |
||||||
|
* @return 位置面板 |
||||||
|
*/ |
||||||
|
public static BasicBeanPane<Plot> createCustomPlotPositionPane(Plot plot) { |
||||||
|
Class<? extends Plot> key = plot.getClass(); |
||||||
|
if(plotPositionMap.containsKey(key)){ |
||||||
|
try{ |
||||||
|
Class<? extends BasicBeanPane<Plot>> cl = plotPositionMap.get(key); |
||||||
|
Constructor<? extends BasicBeanPane<Plot> > constructor = cl.getConstructor(); |
||||||
|
return constructor.newInstance(); |
||||||
|
} catch (Exception e){ |
||||||
|
FRLogger.getLogger().error(e.getMessage()); |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 每种类型对应的数据配置界面 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
static { |
||||||
|
plotTableDataContentPaneMap.put(VanChartScatterPlot.class, VanChartScatterPlotTableDataContentPane.class); |
||||||
|
plotTableDataContentPaneMap.put(VanChartBubblePlot.class, VanChartBubblePlotTableDataContentPane.class); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据图表类型创建数据配置 |
||||||
|
* @param plot 图表 |
||||||
|
* @param parent |
||||||
|
* @return 数据配置界面 |
||||||
|
*/ |
||||||
|
public static AbstractTableDataContentPane createCustomPlotTableDataContentPane(Plot plot, ChartDataPane parent) { |
||||||
|
Class<? extends Plot> key = plot.getClass(); |
||||||
|
if(plotTableDataContentPaneMap.containsKey(key)){ |
||||||
|
try{ |
||||||
|
Class<? extends AbstractTableDataContentPane> cl = plotTableDataContentPaneMap.get(key); |
||||||
|
Constructor<? extends AbstractTableDataContentPane > constructor = cl.getConstructor(ChartDataPane.class); |
||||||
|
return constructor.newInstance(parent); |
||||||
|
} catch (Exception e){ |
||||||
|
FRLogger.getLogger().error(e.getMessage()); |
||||||
|
} |
||||||
|
} |
||||||
|
return new CategoryPlotTableDataContentPane(parent); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* plotType是否需要建立新的坐标系面板 |
||||||
|
*/ |
||||||
|
private static Map<CustomPlotType, Class<? extends VanChartAxisPane>> diffAxisMap = new HashMap<CustomPlotType, Class<? extends VanChartAxisPane>>(); |
||||||
|
static { |
||||||
|
diffAxisMap.put(CustomPlotType.POINTER_360, VanChartGaugeAxisPane.class); |
||||||
|
diffAxisMap.put(CustomPlotType.POINTER_180, VanChartGaugeAxisPane.class); |
||||||
|
diffAxisMap.put(CustomPlotType.RING, VanChartGaugeAxisPane.class); |
||||||
|
diffAxisMap.put(CustomPlotType.SLOT, VanChartGaugeAxisPane.class); |
||||||
|
diffAxisMap.put(CustomPlotType.CUVETTE, VanChartGaugeAxisPane.class); |
||||||
|
diffAxisMap.put(CustomPlotType.RADAR, null);//默认的为null,直接new,不用反射
|
||||||
|
diffAxisMap.put(CustomPlotType.STACK_RADAR, null); |
||||||
|
} |
||||||
|
|
||||||
|
public static Boolean isUseDiffAxisPane(VanChartPlot plot){ |
||||||
|
CustomPlotType customPlotType = CustomPlotFactory.getCustomType(plot); |
||||||
|
return diffAxisMap.containsKey(customPlotType); |
||||||
|
} |
||||||
|
|
||||||
|
public static VanChartAxisPane createAxisPane(VanChartAxisPlot plot, VanChartStylePane parent) { |
||||||
|
CustomPlotType key = CustomPlotFactory.getCustomType((VanChartPlot)plot); |
||||||
|
if(diffAxisMap.containsKey(key)){ |
||||||
|
try{ |
||||||
|
Class<? extends VanChartAxisPane> cl = diffAxisMap.get(key); |
||||||
|
if(cl != null) { |
||||||
|
Constructor<? extends VanChartAxisPane> constructor = cl.getConstructor(VanChartAxisPlot.class, VanChartStylePane.class); |
||||||
|
return constructor.newInstance(plot, parent); |
||||||
|
} |
||||||
|
} catch (Exception e){ |
||||||
|
FRLogger.getLogger().error(e.getMessage()); |
||||||
|
} |
||||||
|
} |
||||||
|
return new VanChartAxisPane(plot,parent); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,66 @@ |
|||||||
|
package com.fr.plugin.chart.custom; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Chart; |
||||||
|
import com.fr.chart.chartattr.ChartCollection; |
||||||
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Fangjie on 2016/4/29. |
||||||
|
*/ |
||||||
|
public class VanChartCustomDataPane extends ChartDataPane { |
||||||
|
private VanChartCustomPlotDataContentsTabPane contentsTabPane; |
||||||
|
private Chart chart; |
||||||
|
public VanChartCustomDataPane(AttributeChangeListener listener) { |
||||||
|
super(listener); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected JPanel createContentPane() { |
||||||
|
JPanel content = new JPanel(new BorderLayout()); |
||||||
|
if (chart == null) { |
||||||
|
return content; |
||||||
|
} |
||||||
|
|
||||||
|
contentsTabPane = new VanChartCustomPlotDataContentsTabPane((VanChartCustomPlot)chart.getPlot(), VanChartCustomDataPane.this, listener); |
||||||
|
|
||||||
|
content.add(contentsTabPane, BorderLayout.CENTER); |
||||||
|
return content; |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public void populate(ChartCollection collection) { |
||||||
|
this.chart = collection.getSelectedChart(); |
||||||
|
this.remove(leftContentPane); |
||||||
|
initContentPane(); |
||||||
|
this.removeAttributeChangeListener(); |
||||||
|
contentsTabPane.populateBean(collection); |
||||||
|
this.addAttributeChangeListener(listener); |
||||||
|
this.initAllListeners(); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
/** |
||||||
|
* 返回绑定的属性事件. |
||||||
|
* @param listener 增加监听 |
||||||
|
*/ |
||||||
|
public void addAttributeChangeListener(AttributeChangeListener listener) { |
||||||
|
super.addAttributeChangeListener(listener); |
||||||
|
contentsTabPane.addAttributeChangeListener(listener); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
/** |
||||||
|
* 保存 数据界面内容 |
||||||
|
*/ |
||||||
|
public void update(ChartCollection collection){ |
||||||
|
if(contentsTabPane != null) { |
||||||
|
contentsTabPane.updateBean(collection); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,175 @@ |
|||||||
|
package com.fr.plugin.chart.custom; |
||||||
|
|
||||||
|
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||||
|
import com.fr.chart.chartattr.ChartCollection; |
||||||
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||||
|
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||||
|
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||||
|
import com.fr.plugin.chart.custom.component.VanChartCustomPlotTabPane; |
||||||
|
import com.fr.plugin.chart.custom.component.VanChartDataPane; |
||||||
|
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Fangjie on 2016/4/29. |
||||||
|
*/ |
||||||
|
public class VanChartCustomPlotDataContentsTabPane extends VanChartCustomPlotTabPane<VanChartCustomPlot, ChartCollection> { |
||||||
|
public VanChartCustomPlotDataContentsTabPane(VanChartCustomPlot plot, VanChartCustomDataPane parent, AttributeChangeListener listener) { |
||||||
|
super(plot, parent, listener); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initTabTitle() { |
||||||
|
|
||||||
|
if (plot == null){ |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||||
|
NameArray = new String[Math.min(customPlotList.size(), paneList.size())]; |
||||||
|
for (int i = 0; i < customPlotList.size() && i < paneList.size(); i++) { |
||||||
|
JPanel pane = paneList.get(i); |
||||||
|
//获取点的tooltip作为标题
|
||||||
|
VanChartPlot vanChartPlot = customPlotList.get(i); |
||||||
|
CustomPlotType plotType = CustomPlotFactory.getCustomType(vanChartPlot); |
||||||
|
|
||||||
|
NameArray[i] = CustomPlotFactory.getTitle(plotType); |
||||||
|
centerPane.add(pane, NameArray[i]); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected List<JPanel> initPaneList() { |
||||||
|
|
||||||
|
if (plot == null){ |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
List<JPanel> paneList = new ArrayList<JPanel>(); |
||||||
|
|
||||||
|
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||||
|
|
||||||
|
for (int i = 0; i < customPlotList.size(); i++){ |
||||||
|
//根据不同的plot创建不同的数据配置界面
|
||||||
|
ChartDataPane contentPane = new VanChartDataPane(listener); |
||||||
|
paneList.add(contentPane); |
||||||
|
} |
||||||
|
|
||||||
|
return paneList; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(ChartCollection chartCollection){ |
||||||
|
|
||||||
|
plot = (VanChartCustomPlot) chartCollection.getSelectedChart().getPlot(); |
||||||
|
|
||||||
|
if (paneList == null){ |
||||||
|
paneList = initPaneList(); |
||||||
|
} |
||||||
|
|
||||||
|
if (paneList != null){ |
||||||
|
|
||||||
|
try { |
||||||
|
|
||||||
|
List<VanChartPlot> customPlotList = plot.getCustomPlotList(); |
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < paneList.size() && i < customPlotList.size(); i++) { |
||||||
|
//將plot包裝起来,主要是为了获取dataDefinition
|
||||||
|
ChartCollection cloneCollection = (ChartCollection) chartCollection.clone(); |
||||||
|
|
||||||
|
//设置collection的plot
|
||||||
|
cloneCollection.getSelectedChart().setPlot(customPlotList.get(i)); |
||||||
|
|
||||||
|
//获取definitionMap中的dataDefinition
|
||||||
|
TopDefinitionProvider definition = chartCollection.getSelectedChart().getFilterDefinition(); |
||||||
|
TopDefinitionProvider dataDefinition = null; |
||||||
|
if (definition != null && definition instanceof CustomDefinition) { |
||||||
|
Map<CustomPlotType, TopDefinitionProvider> definitionProviderMap = ((CustomDefinition)definition).getDefinitionProviderMap(); |
||||||
|
dataDefinition = definitionProviderMap.get(CustomPlotFactory.getCustomType(customPlotList.get(i))); |
||||||
|
} |
||||||
|
cloneCollection.getSelectedChart().setFilterDefinition(dataDefinition); |
||||||
|
|
||||||
|
((ChartDataPane) paneList.get(i)).populate(cloneCollection); |
||||||
|
} |
||||||
|
}catch (Exception e){ |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public ChartCollection updateBean() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void updateBean(ChartCollection collection){ |
||||||
|
if (paneList == null || plot == null){ |
||||||
|
return; |
||||||
|
} |
||||||
|
try { |
||||||
|
|
||||||
|
Map<CustomPlotType, TopDefinitionProvider> definitionMap = new HashMap<CustomPlotType, TopDefinitionProvider>(); |
||||||
|
|
||||||
|
//已经有的数据配置不允许重置
|
||||||
|
|
||||||
|
for (int i = 0; i < paneList.size() && i < plot.getCustomPlotList().size(); i++) { |
||||||
|
//将plot包裝起来,主要是为了获取dataDefinition
|
||||||
|
ChartCollection cloneCollection = (ChartCollection) collection.clone(); |
||||||
|
|
||||||
|
//设置Collection的plot
|
||||||
|
cloneCollection.getSelectedChart().setPlot(plot.getCustomPlotList().get(i)); |
||||||
|
|
||||||
|
//重置
|
||||||
|
cloneCollection.getSelectedChart().setFilterDefinition(null); |
||||||
|
|
||||||
|
//更新
|
||||||
|
((ChartDataPane) paneList.get(i)).update(cloneCollection); |
||||||
|
|
||||||
|
CustomPlotFactory.setCustomCategoryAttr(plot); |
||||||
|
|
||||||
|
//将处理好的dataDefinition剥离出来并存储
|
||||||
|
definitionMap.put(CustomPlotFactory.getCustomType(plot.getCustomPlotList().get(i)), cloneCollection.getSelectedChart().getFilterDefinition()); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
CustomDefinition customDefinition = new CustomDefinition(); |
||||||
|
customDefinition.setDefinitionProviderMap(definitionMap); |
||||||
|
collection.getSelectedChart().setFilterDefinition(customDefinition); |
||||||
|
|
||||||
|
}catch (Exception e){ |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean accept(Object ob) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void reset() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回绑定的属性事件. |
||||||
|
* @param listener 增加监听 |
||||||
|
*/ |
||||||
|
public void addAttributeChangeListener(AttributeChangeListener listener) { |
||||||
|
for (int i = 0; i < paneList.size(); i++){ |
||||||
|
((ChartDataPane) paneList.get(i)).addAttributeChangeListener(listener); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,296 @@ |
|||||||
|
package com.fr.plugin.chart.custom; |
||||||
|
|
||||||
|
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||||
|
import com.fr.chart.base.DataSeriesCondition; |
||||||
|
import com.fr.chart.chartattr.Chart; |
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.chart.chartglyph.ConditionAttr; |
||||||
|
import com.fr.chart.chartglyph.ConditionCollection; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; |
||||||
|
import com.fr.general.FRLogger; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.plugin.chart.base.VanChartTools; |
||||||
|
import com.fr.plugin.chart.base.VanChartAttrLine; |
||||||
|
import com.fr.plugin.chart.custom.component.VanChartCustomPlotSelectPane; |
||||||
|
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||||
|
import com.fr.plugin.chart.custom.type.CustomStyle; |
||||||
|
import com.fr.plugin.chart.custom.CustomPlotFactory; |
||||||
|
import com.fr.plugin.chart.designer.type.AbstractVanChartTypePane; |
||||||
|
import com.fr.plugin.chart.vanchart.VanChart; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Mitisky on 16/2/16. |
||||||
|
*/ |
||||||
|
public class VanChartCustomPlotPane extends AbstractVanChartTypePane { |
||||||
|
public static final String TITLE = Inter.getLocText("Plugin-ChartF_NewCustom"); |
||||||
|
|
||||||
|
//是否选择自定义
|
||||||
|
private boolean isCustom = false; |
||||||
|
|
||||||
|
private static final long serialVersionUID = -3481633368542654247L; |
||||||
|
|
||||||
|
//切换到自定义组合图时,显示的版面
|
||||||
|
private JPanel customPane; |
||||||
|
private VanChartCustomPlotSelectPane customSelectPane; |
||||||
|
|
||||||
|
private JPanel autoPane; |
||||||
|
|
||||||
|
//自定义和自动版面的容器,cardLayOut布局
|
||||||
|
private JPanel contentPane; |
||||||
|
|
||||||
|
protected Component[][] getPaneComponents(JPanel typePane){ |
||||||
|
|
||||||
|
initContent(); |
||||||
|
|
||||||
|
return new Component[][]{ |
||||||
|
new Component[]{typePane}, |
||||||
|
new Component[]{stylePane}, |
||||||
|
new Component[]{contentPane} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void initContent() { |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
|
|
||||||
|
autoPane = new JPanel(); |
||||||
|
|
||||||
|
customSelectPane = new VanChartCustomPlotSelectPane(); |
||||||
|
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new JSeparator()}, |
||||||
|
new Component[]{customSelectPane} |
||||||
|
}; |
||||||
|
|
||||||
|
double[] columnSize = {p, f}; |
||||||
|
double[] rowSize = {p, p}; |
||||||
|
customPane = TableLayoutHelper.createTableLayoutPane(components, rowSize , columnSize); |
||||||
|
|
||||||
|
contentPane = new JPanel(new CardLayout()){ |
||||||
|
@Override |
||||||
|
public Dimension getPreferredSize() { |
||||||
|
if(isCustom){ |
||||||
|
return customPane.getPreferredSize(); |
||||||
|
} else{ |
||||||
|
return new Dimension(autoPane.getWidth(), 0); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
contentPane.add(autoPane, "auto"); |
||||||
|
contentPane.add(customPane, "custom"); |
||||||
|
} |
||||||
|
|
||||||
|
private void checkCardPane() { |
||||||
|
CardLayout cardLayout = (CardLayout) contentPane.getLayout(); |
||||||
|
if (isCustom) { |
||||||
|
cardLayout.show(contentPane, "custom"); |
||||||
|
} else { |
||||||
|
cardLayout.show(contentPane, "auto"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected String[] getTypeIconPath() { |
||||||
|
return new String[]{"/com/fr/plugin/chart/custom/images/column_line.png", |
||||||
|
"/com/fr/plugin/chart/custom/images/column_area.png", |
||||||
|
"/com/fr/plugin/chart/custom/images/stack_column_line.png", |
||||||
|
"/com/fr/plugin/chart/custom/images/custom.png", |
||||||
|
|
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String[] getTypeTipName() { |
||||||
|
return new String[]{ |
||||||
|
Inter.getLocText("Plugin-ChartF_NewCustom_ColumnLine"), |
||||||
|
Inter.getLocText("Plugin-ChartF_NewCustom_ColumnArea"), |
||||||
|
Inter.getLocText("Plugin-ChartF_NewCustom_StackColumnLine"), |
||||||
|
Inter.getLocText("Plugin-ChartF_NewCustom_Custom") |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
/** |
||||||
|
* 返回界面标题 |
||||||
|
* @return 界面标题 |
||||||
|
*/ |
||||||
|
public String title4PopupWindow() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_NewCustom"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void updateBean(Chart chart) { |
||||||
|
|
||||||
|
//保存上次选中的值,其会在super中更新
|
||||||
|
int lastState = lastTypeIndex; |
||||||
|
|
||||||
|
super.updateBean(chart); |
||||||
|
|
||||||
|
//如果上次的状态和这次的装填不在同一个页面,说明同一个图表內切换了,需要情況数据配置
|
||||||
|
if (lastState != lastTypeIndex) { |
||||||
|
chart.setFilterDefinition(null); |
||||||
|
} |
||||||
|
|
||||||
|
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; |
||||||
|
for(int i = 0, len = customChart.length; i < len; i++){ |
||||||
|
if(typeDemo.get(i).isPressing){ |
||||||
|
if (i == customChart.length-1){ |
||||||
|
isCustom = true; |
||||||
|
|
||||||
|
//先重置自定义组合面板,如果不重置,无法获取选择顺序
|
||||||
|
if (lastState == customChart.length-1 && samePlot) { |
||||||
|
//更新数据配置,刪除已经不在的图表数据
|
||||||
|
dealCustomDefinition(chart); |
||||||
|
|
||||||
|
customSelectPane.updateBean(chart); |
||||||
|
}else if (samePlot){//如果是同一个图表切换过来,则重置面板
|
||||||
|
customSelectPane.populateBean(chart); |
||||||
|
} |
||||||
|
} |
||||||
|
}else { |
||||||
|
isCustom = false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
checkCardPane(); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void dealCustomDefinition(Chart chart) { |
||||||
|
CustomDefinition definition = (CustomDefinition) chart.getFilterDefinition(); |
||||||
|
|
||||||
|
if (definition == null){ |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
Map<CustomPlotType, TopDefinitionProvider> definitionMap = definition.getDefinitionProviderMap(); |
||||||
|
|
||||||
|
if (definitionMap == null){ |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
Map<CustomPlotType, TopDefinitionProvider> newDefinitionMap = new HashMap<CustomPlotType, TopDefinitionProvider>(); |
||||||
|
|
||||||
|
VanChartCustomPlot customPlot = (VanChartCustomPlot) chart.getPlot(); |
||||||
|
for (int i = 0; i < customPlot.getCustomPlotList().size(); i++){ |
||||||
|
CustomPlotType plotType = CustomPlotFactory.getCustomType(customPlot.getCustomPlotList().get(i)); |
||||||
|
TopDefinitionProvider definitionProvider = definitionMap.get(plotType); |
||||||
|
|
||||||
|
newDefinitionMap.put(plotType, definitionProvider); |
||||||
|
} |
||||||
|
|
||||||
|
definition.setDefinitionProviderMap(newDefinitionMap); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 不同图表切換,重置chart屬性 |
||||||
|
* @param chart |
||||||
|
* @param newPlot |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
protected void resetChartAttr(Chart chart, Plot newPlot){ |
||||||
|
super.resetChartAttr(chart, newPlot); |
||||||
|
//切换图表清空数据配置
|
||||||
|
chart.setFilterDefinition(null); |
||||||
|
//设置默认不排序
|
||||||
|
VanChartTools tools = ((VanChart)chart).getVanChartTools(); |
||||||
|
if (tools != null) { |
||||||
|
tools.setSort(false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新界面内容 |
||||||
|
*/ |
||||||
|
public void populateBean(Chart chart) { |
||||||
|
for(ChartImagePane imagePane : typeDemo) { |
||||||
|
imagePane.isPressing = false; |
||||||
|
} |
||||||
|
|
||||||
|
//获取上次选中的图标
|
||||||
|
VanChartCustomPlot customPlot = (VanChartCustomPlot)chart.getPlot(); |
||||||
|
lastTypeIndex = customPlot.getCustomStyle().ordinal(); |
||||||
|
typeDemo.get(lastTypeIndex).isPressing = true; |
||||||
|
|
||||||
|
isCustom = customPlot.getCustomStyle() == CustomStyle.CUSTOM; |
||||||
|
|
||||||
|
//自定义选择时,更新自定义面板
|
||||||
|
if (isCustom){ |
||||||
|
customSelectPane.populateBean(chart); |
||||||
|
} |
||||||
|
|
||||||
|
checkCardPane(); |
||||||
|
|
||||||
|
checkDemosBackground(); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取各图表类型界面ID, 本质是plotID |
||||||
|
* |
||||||
|
* @return 图表类型界面ID |
||||||
|
*/ |
||||||
|
@Override |
||||||
|
protected String getPlotTypeID() { |
||||||
|
return VanChartCustomPlot.VAN_CHART_CUSTOM_PLOT_ID; |
||||||
|
} |
||||||
|
|
||||||
|
protected Plot getSelectedClonedPlot(){ |
||||||
|
VanChartCustomPlot newPlot = null; |
||||||
|
Chart[] customChart = CustomIndependentVanChart.CustomVanChartTypes; |
||||||
|
for(int i = 0, len = customChart.length; i < len; i++){ |
||||||
|
if(typeDemo.get(i).isPressing){ |
||||||
|
newPlot = (VanChartCustomPlot)customChart[i].getPlot(); |
||||||
|
} |
||||||
|
} |
||||||
|
Plot cloned = null; |
||||||
|
try { |
||||||
|
cloned = (Plot)newPlot.clone(); |
||||||
|
} catch (CloneNotSupportedException e) { |
||||||
|
FRLogger.getLogger().error("Error In ScatterChart"); |
||||||
|
} |
||||||
|
return cloned; |
||||||
|
} |
||||||
|
|
||||||
|
public Chart getDefaultChart() { |
||||||
|
return CustomIndependentVanChart.CustomVanChartTypes[0]; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
/** |
||||||
|
*删除配置的条件属性 |
||||||
|
*/ |
||||||
|
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ |
||||||
|
cloneOldDefaultAttrConditionCollection(oldPlot, newPlot); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
/** |
||||||
|
* 删除线型配置 |
||||||
|
*/ |
||||||
|
protected void cloneOldDefaultAttrConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ |
||||||
|
if (oldPlot.getConditionCollection() != null) { |
||||||
|
ConditionCollection newCondition = new ConditionCollection(); |
||||||
|
newCondition.setDefaultAttr((ConditionAttr) oldPlot.getConditionCollection().getDefaultAttr().clone()); |
||||||
|
newPlot.setConditionCollection(newCondition); |
||||||
|
|
||||||
|
//删除线型设置
|
||||||
|
ConditionAttr attrList = newCondition.getDefaultAttr(); |
||||||
|
DataSeriesCondition attr = attrList.getExisted(VanChartAttrLine.class); |
||||||
|
if (attr != null){ |
||||||
|
attrList.remove(VanChartAttrLine.class); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
package com.fr.plugin.chart.custom.component; |
||||||
|
|
||||||
|
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||||
|
import com.fr.design.mainframe.chart.gui.data.table.CategoryPlotTableDataContentPane; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Fangjie on 2016/5/18. |
||||||
|
*/ |
||||||
|
public class CategoryCustomPlotTableDataContentPane extends CategoryPlotTableDataContentPane { |
||||||
|
public CategoryCustomPlotTableDataContentPane() { |
||||||
|
super(); |
||||||
|
} |
||||||
|
|
||||||
|
public CategoryCustomPlotTableDataContentPane(ChartDataPane parent) { |
||||||
|
super(parent); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 检查 某些Box是否可用 |
||||||
|
* 分类不可用 |
||||||
|
* @param hasUse 是否使用 |
||||||
|
*/ |
||||||
|
public void checkBoxUse(boolean hasUse) { |
||||||
|
categoryCombox.setEnabled(false); |
||||||
|
checkSeriseUse(hasUse); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,103 @@ |
|||||||
|
package com.fr.plugin.chart.custom.component; |
||||||
|
|
||||||
|
import com.fr.design.constants.UIConstants; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.event.UIObserver; |
||||||
|
import com.fr.design.event.UIObserverListener; |
||||||
|
import com.fr.plugin.chart.custom.CustomPlotFactory; |
||||||
|
import com.fr.plugin.chart.custom.type.CustomPlotType; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import javax.swing.event.ChangeEvent; |
||||||
|
import javax.swing.event.ChangeListener; |
||||||
|
import java.awt.*; |
||||||
|
import java.util.ArrayList; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by Fangjie on 2016/4/19. |
||||||
|
*/ |
||||||
|
public class ChartImageCheckOutPane extends BasicPane implements UIObserver { |
||||||
|
|
||||||
|
private JCheckBox checkBox; |
||||||
|
private CustomPlotType customPlotType; |
||||||
|
private ArrayList<ChangeListener> changeListeners = new ArrayList<ChangeListener>(); |
||||||
|
|
||||||
|
public ChartImageCheckOutPane(CustomPlotType type){ |
||||||
|
this(type, false); |
||||||
|
} |
||||||
|
|
||||||
|
public ChartImageCheckOutPane( CustomPlotType type, boolean isSelected){ |
||||||
|
this.customPlotType = type; |
||||||
|
|
||||||
|
initCheckBox(isSelected); |
||||||
|
|
||||||
|
this.add(checkBox, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
public CustomPlotType getCustomPlotType() { |
||||||
|
return customPlotType; |
||||||
|
} |
||||||
|
|
||||||
|
private void initCheckBox(boolean isSelected) { |
||||||
|
this.checkBox = new JCheckBox(); |
||||||
|
this.checkBox.setSelected(isSelected); |
||||||
|
//设置提示
|
||||||
|
this.checkBox.setToolTipText(CustomPlotFactory.getTooltipText(this.customPlotType)); |
||||||
|
//背景
|
||||||
|
checkBox.setIcon(new ImageIcon(getClass().getResource(getIconPath(customPlotType,isSelected)))); |
||||||
|
|
||||||
|
this.setLayout(new BorderLayout()); |
||||||
|
} |
||||||
|
|
||||||
|
private String getIconPath(CustomPlotType customPlotType, boolean isSelected) { |
||||||
|
return isSelected ? CustomPlotFactory.getTypeIconPath(customPlotType)[0] : CustomPlotFactory.getTypeIconPath(customPlotType)[1]; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public JCheckBox getCheckBox() { |
||||||
|
return checkBox; |
||||||
|
} |
||||||
|
|
||||||
|
public void checkIconImage(){ |
||||||
|
checkBox.setIcon(new ImageIcon(getClass().getResource(getIconPath(customPlotType, checkBox.isSelected())))); |
||||||
|
} |
||||||
|
|
||||||
|
public void setPaneBorder(boolean isRightLine, boolean isBottomLine){ |
||||||
|
this.setBorder(BorderFactory.createMatteBorder(1, 1, isBottomLine ? 1 : 0, isRightLine ? 1 : 0, UIConstants.LINE_COLOR)); |
||||||
|
} |
||||||
|
|
||||||
|
public void setSelected(boolean isSelected){ |
||||||
|
checkBox.setSelected(isSelected); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isSelected(){ |
||||||
|
return checkBox.isSelected(); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public void fireStateChange() { |
||||||
|
for (int i = 0; i < changeListeners.size(); i++) { |
||||||
|
changeListeners.get(i).stateChanged(new ChangeEvent(this)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void registerChangeListener(final UIObserverListener listener) { |
||||||
|
changeListeners.add(new ChangeListener() { |
||||||
|
public void stateChanged(ChangeEvent e) { |
||||||
|
listener.doChange(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean shouldResponseChangeListener() { |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |