richie
9 years ago
42 changed files with 1070 additions and 275 deletions
@ -0,0 +1,45 @@
|
||||
package com.fr.solution.plugin.chart.echarts; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.general.Inter; |
||||
import com.fr.solution.plugin.chart.echarts.base.AbstractIndependentEChartsProvider; |
||||
import com.fr.solution.plugin.chart.echarts.base.ECharts; |
||||
import com.fr.solution.plugin.chart.echarts.plot.pie.EChartsPiePlot; |
||||
import com.fr.solution.plugin.chart.echarts.plot.pie.PieType; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class EChartsPie extends AbstractIndependentEChartsProvider { |
||||
|
||||
private static ECharts createPie(PieType type) { |
||||
EChartsPiePlot plot = new EChartsPiePlot(type); |
||||
return new ECharts(plot); |
||||
} |
||||
|
||||
public static ECharts[] charts = new ECharts[] { |
||||
createPie(PieType.REGULAR), |
||||
createPie(PieType.CIRCLE) |
||||
}; |
||||
|
||||
|
||||
@Override |
||||
public String getChartName() { |
||||
return "Plugin-ECharts_Pie"; |
||||
} |
||||
|
||||
@Override |
||||
public String getChartUseName() { |
||||
return Inter.getLocText("Plugin-ECharts_Pie"); |
||||
} |
||||
|
||||
@Override |
||||
public Chart[] getChartTypes() { |
||||
return charts; |
||||
} |
||||
|
||||
@Override |
||||
public String getChartImagePath() { |
||||
return "com/fr/solution/plugin/chart/echarts/images/pie/pie256.png"; |
||||
} |
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.fr.solution.plugin.chart.echarts; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||
import com.fr.solution.plugin.chart.echarts.ui.AbstractIndependentEChartsUI; |
||||
import com.fr.solution.plugin.chart.echarts.ui.pie.EChartsPieChartTypePane; |
||||
import com.fr.solution.plugin.chart.echarts.ui.pie.EChartsPieReportDataContentPane; |
||||
import com.fr.solution.plugin.chart.echarts.ui.pie.EChartsPieTableDataContentPane; |
||||
|
||||
/** |
||||
* Created by richie on 16/1/29. |
||||
*/ |
||||
public class EChartsPieUI extends AbstractIndependentEChartsUI { |
||||
|
||||
@Override |
||||
public AbstractChartTypePane getPlotTypePane() { |
||||
return new EChartsPieChartTypePane(); |
||||
} |
||||
|
||||
@Override |
||||
public AbstractTableDataContentPane getTableDataSourcePane(Plot plot, ChartDataPane parent) { |
||||
return new EChartsPieTableDataContentPane(parent); |
||||
} |
||||
|
||||
@Override |
||||
public AbstractReportDataContentPane getReportDataSourcePane(Plot plot, ChartDataPane parent) { |
||||
return new EChartsPieReportDataContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public String getIconPath() { |
||||
return "com/fr/solution/plugin/chart/echarts/images/pie/pie.png"; |
||||
} |
||||
} |
@ -1,28 +0,0 @@
|
||||
package com.fr.solution.plugin.chart.echarts.core.map; |
||||
|
||||
import com.fr.chart.chartglyph.PlotGlyph; |
||||
|
||||
/** |
||||
* Created by richie on 16/1/29. |
||||
*/ |
||||
public class ChineseMapPlotGlyph extends PlotGlyph { |
||||
@Override |
||||
public void layoutAxisGlyph(int resolution) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void layoutDataSeriesGlyph(int resolution) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public String getPlotGlyphType() { |
||||
return "ChineseMapPlotGlyph"; |
||||
} |
||||
|
||||
@Override |
||||
public String getChartType() { |
||||
return "ChineseMap"; |
||||
} |
||||
} |
@ -0,0 +1,50 @@
|
||||
package com.fr.solution.plugin.chart.echarts.glyph; |
||||
|
||||
import com.fr.chart.chartglyph.ChartGlyph; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.stable.web.Repository; |
||||
|
||||
/** |
||||
* Created by richie on 16/1/29. |
||||
*/ |
||||
public class EChartsGlyph extends ChartGlyph { |
||||
|
||||
@Override |
||||
public JSONObject toJSONObject(Repository repo) throws JSONException { |
||||
JSONObject jo = new JSONObject(); |
||||
EChartsTitleGlyph titleGlyph = (EChartsTitleGlyph) getTitleGlyph(); |
||||
if (titleGlyph != null) { |
||||
jo.put("title", titleGlyph.toJSONObject(repo)); |
||||
} |
||||
jo.put("tooltip", createTooltip(repo)); |
||||
|
||||
EChartsLegendGlyph legendGlyph = (EChartsLegendGlyph) getLegendGlyph(); |
||||
if (legendGlyph != null) { |
||||
jo.put("legend", legendGlyph.toJSONObject(repo)); |
||||
} |
||||
jo.put("dataRange", createDataRange(repo)); |
||||
EChartsPlotGlyph plotGlyph = (EChartsPlotGlyph) getPlotGlyph(); |
||||
if (plotGlyph != null) { |
||||
jo.put("series", plotGlyph.toSeriesData(repo)); |
||||
} |
||||
return jo; |
||||
} |
||||
|
||||
|
||||
private JSONObject createTooltip(Repository repo) throws JSONException { |
||||
return JSONObject.create() |
||||
.put("trigger", "item"); |
||||
} |
||||
|
||||
|
||||
private JSONObject createDataRange(Repository repo) throws JSONException { |
||||
return JSONObject.create() |
||||
.put("min", 0) |
||||
.put("max", 2500) |
||||
.put("x", "left") |
||||
.put("y", "bottom") |
||||
.put("text", JSONArray.create().put("高").put("低")); |
||||
} |
||||
} |
@ -0,0 +1,30 @@
|
||||
package com.fr.solution.plugin.chart.echarts.glyph; |
||||
|
||||
import com.fr.chart.chartglyph.PlotGlyph; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.stable.web.Repository; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public abstract class EChartsPlotGlyph extends PlotGlyph { |
||||
|
||||
@Override |
||||
public void layoutAxisGlyph(int resolution) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void layoutDataSeriesGlyph(int resolution) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public JSONObject toJSONObject(Repository repo) throws JSONException { |
||||
throw new UnsupportedOperationException("Not support yet!"); |
||||
} |
||||
|
||||
public abstract JSONArray toSeriesData(Repository repo) throws JSONException; |
||||
} |
@ -1,106 +0,0 @@
|
||||
package com.fr.solution.plugin.chart.echarts.glyph; |
||||
|
||||
import com.fr.chart.chartglyph.ChartGlyph; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.solution.plugin.chart.echarts.glyph.NewLegendGlyph; |
||||
import com.fr.solution.plugin.chart.echarts.glyph.NewTitleGlyph; |
||||
import com.fr.stable.web.Repository; |
||||
|
||||
/** |
||||
* Created by richie on 16/1/29. |
||||
*/ |
||||
public class NewGlyph extends ChartGlyph { |
||||
|
||||
private NewTitleGlyph titleGlyph; |
||||
|
||||
private NewLegendGlyph legendGlyph; |
||||
|
||||
|
||||
public void setTitleGlyph(NewTitleGlyph titleGlyph) { |
||||
this.titleGlyph = titleGlyph; |
||||
} |
||||
|
||||
@Override |
||||
public NewLegendGlyph getLegendGlyph() { |
||||
return legendGlyph; |
||||
} |
||||
|
||||
public void setLegendGlyph(NewLegendGlyph legendGlyph) { |
||||
this.legendGlyph = legendGlyph; |
||||
} |
||||
|
||||
@Override |
||||
public JSONObject toJSONObject(Repository repo) throws JSONException { |
||||
JSONObject jo = new JSONObject(); |
||||
//jo.put("title", createTitle(repo));
|
||||
if (titleGlyph != null) { |
||||
jo.put("title", titleGlyph.toJSONObject(repo)); |
||||
} |
||||
jo.put("tooltip", createTooltip(repo)); |
||||
|
||||
|
||||
// jo.put("legend", createLegend(repo));
|
||||
|
||||
if (legendGlyph != null) { |
||||
jo.put("legend", legendGlyph.toJSONObject(repo)); |
||||
} |
||||
jo.put("dataRange", createDataRange(repo)); |
||||
jo.put("series", createSeries(repo)); |
||||
return jo; |
||||
} |
||||
|
||||
|
||||
private JSONObject createTooltip(Repository repo) throws JSONException { |
||||
return JSONObject.create() |
||||
.put("trigger", "item"); |
||||
} |
||||
|
||||
|
||||
private JSONObject createDataRange(Repository repo) throws JSONException { |
||||
return JSONObject.create() |
||||
.put("min", 0) |
||||
.put("max", 2500) |
||||
.put("x", "left") |
||||
.put("y", "bottom") |
||||
.put("text", JSONArray.create().put("高").put("低")); |
||||
} |
||||
|
||||
private JSONArray createSeries(Repository repo) throws JSONException { |
||||
JSONArray series = JSONArray.create(); |
||||
|
||||
series.put(JSONObject.create() |
||||
.put("name", "iPhone3") |
||||
.put("type", "map") |
||||
.put("mapType", "china") |
||||
.put("itemStyle", createItemStyle(repo)) |
||||
.put("data", JSONArray.create().put(JSONObject.create().put("name", "北京").put("value", 20))) |
||||
); |
||||
|
||||
series.put(JSONObject.create() |
||||
.put("name", "iPhone4") |
||||
.put("type", "map") |
||||
.put("mapType", "china") |
||||
.put("itemStyle", createItemStyle(repo)) |
||||
.put("data", JSONArray.create().put(JSONObject.create().put("name", "江苏").put("value", 20))) |
||||
); |
||||
|
||||
series.put(JSONObject.create() |
||||
.put("name", "iPhone5") |
||||
.put("type", "map") |
||||
.put("mapType", "china") |
||||
.put("itemStyle", createItemStyle(repo)) |
||||
.put("data", JSONArray.create().put(JSONObject.create().put("name", "四川").put("value", 20))) |
||||
); |
||||
|
||||
return series; |
||||
} |
||||
|
||||
private JSONObject createItemStyle(Repository repo) throws JSONException { |
||||
JSONObject itemStyle = JSONObject.create(); |
||||
itemStyle.put("normal", JSONObject.create().put("label", JSONObject.create().put("show", true))); |
||||
itemStyle.put("emphasis", JSONObject.create().put("label", JSONObject.create().put("show", true))); |
||||
return itemStyle; |
||||
} |
||||
} |
@ -1,10 +0,0 @@
|
||||
package com.fr.solution.plugin.chart.echarts.glyph; |
||||
|
||||
import com.fr.chart.chartglyph.ChartGlyph; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/2. |
||||
*/ |
||||
public class NewSeriesGlyph extends ChartGlyph { |
||||
|
||||
} |
@ -0,0 +1,72 @@
|
||||
package com.fr.solution.plugin.chart.echarts.glyph.map; |
||||
|
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.solution.plugin.chart.echarts.glyph.EChartsPlotGlyph; |
||||
import com.fr.stable.web.Repository; |
||||
|
||||
/** |
||||
* Created by richie on 16/1/29. |
||||
*/ |
||||
public class ChineseMapPlotGlyph extends EChartsPlotGlyph { |
||||
@Override |
||||
public void layoutAxisGlyph(int resolution) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void layoutDataSeriesGlyph(int resolution) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public String getPlotGlyphType() { |
||||
return "ChineseMapPlotGlyph"; |
||||
} |
||||
|
||||
@Override |
||||
public String getChartType() { |
||||
return "ChineseMap"; |
||||
} |
||||
|
||||
public JSONArray toSeriesData(Repository repo) throws JSONException { |
||||
JSONArray series = JSONArray.create(); |
||||
|
||||
series.put(JSONObject.create() |
||||
.put("name", "iPhone3") |
||||
.put("type", "map") |
||||
.put("mapType", "china") |
||||
.put("itemStyle", createItemStyle(repo)) |
||||
.put("data", JSONArray.create().put(JSONObject.create().put("name", "北京").put("value", 20))) |
||||
); |
||||
|
||||
series.put(JSONObject.create() |
||||
.put("name", "iPhone4") |
||||
.put("type", "map") |
||||
.put("mapType", "china") |
||||
.put("itemStyle", createItemStyle(repo)) |
||||
.put("data", JSONArray.create() |
||||
.put(JSONObject.create().put("name", "江苏").put("value", 20)) |
||||
.put(JSONObject.create().put("name", "四川").put("value", 300)) |
||||
) |
||||
); |
||||
|
||||
series.put(JSONObject.create() |
||||
.put("name", "iPhone5") |
||||
.put("type", "map") |
||||
.put("mapType", "china") |
||||
.put("itemStyle", createItemStyle(repo)) |
||||
.put("data", JSONArray.create().put(JSONObject.create().put("name", "四川").put("value", 20))) |
||||
); |
||||
|
||||
return series; |
||||
} |
||||
|
||||
private JSONObject createItemStyle(Repository repo) throws JSONException { |
||||
JSONObject itemStyle = JSONObject.create(); |
||||
itemStyle.put("normal", JSONObject.create().put("label", JSONObject.create().put("show", true))); |
||||
itemStyle.put("emphasis", JSONObject.create().put("label", JSONObject.create().put("show", true))); |
||||
return itemStyle; |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.solution.plugin.chart.echarts.glyph.pie; |
||||
|
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.solution.plugin.chart.echarts.glyph.EChartsPlotGlyph; |
||||
import com.fr.stable.web.Repository; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class EChartsPiePlotGlyph extends EChartsPlotGlyph { |
||||
@Override |
||||
public String getPlotGlyphType() { |
||||
return "EChartsPiePlotGlyph"; |
||||
} |
||||
|
||||
@Override |
||||
public String getChartType() { |
||||
return "EChartsPie"; |
||||
} |
||||
|
||||
public JSONArray toSeriesData(Repository repo) throws JSONException { |
||||
JSONArray series = JSONArray.create(); |
||||
return series; |
||||
} |
||||
} |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 4.6 KiB |
@ -1,17 +1,17 @@
|
||||
package com.fr.solution.plugin.chart.echarts.legend; |
||||
|
||||
import com.fr.chart.chartattr.Legend; |
||||
import com.fr.solution.plugin.chart.echarts.glyph.NewLegendGlyph; |
||||
import com.fr.solution.plugin.chart.echarts.glyph.EChartsLegendGlyph; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class NewLegend extends Legend { |
||||
public class EChartsLegend extends Legend { |
||||
|
||||
public static final String XML_TAG = "NewLegend"; |
||||
public static final String XML_TAG = "EChartsLegend"; |
||||
|
||||
public NewLegendGlyph createLegendGlyph() { |
||||
NewLegendGlyph resultLegendGlyph = new NewLegendGlyph(); |
||||
public EChartsLegendGlyph createLegendGlyph() { |
||||
EChartsLegendGlyph resultLegendGlyph = new EChartsLegendGlyph(); |
||||
|
||||
resultLegendGlyph.setFont(getFRFont()); |
||||
resultLegendGlyph.setGeneralInfo(this); |
@ -1 +1,2 @@
|
||||
Plugin-ECharts_Chinese_Map=Chinese Map |
||||
Plugin-ECharts_Pie=Pie(ECharts) |
@ -1 +1,2 @@
|
||||
Plugin-ECharts_Chinese_Map=\u4E2D\u56FD\u5730\u56FE |
||||
Plugin-ECharts_Pie=\u997C\u56FE(ECharts) |
@ -1,16 +1,19 @@
|
||||
package com.fr.solution.plugin.chart.echarts.core.map; |
||||
package com.fr.solution.plugin.chart.echarts.monitor; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.fun.FunctionHelper; |
||||
import com.fr.stable.fun.FunctionProcessor; |
||||
import com.fr.stable.fun.impl.AbstractFunctionProcessor; |
||||
|
||||
/** |
||||
* Created by richie on 16/1/29. |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class ChineseMapFunctionProcessor extends AbstractFunctionProcessor { |
||||
public class MonitorMap extends AbstractFunctionProcessor { |
||||
|
||||
public static FunctionProcessor MAP = new ChineseMapFunctionProcessor(); |
||||
private static MonitorMap instance = new MonitorMap(); |
||||
|
||||
public static MonitorMap getInstance() { |
||||
return instance; |
||||
} |
||||
|
||||
@Override |
||||
public int getId() { |
@ -0,0 +1,27 @@
|
||||
package com.fr.solution.plugin.chart.echarts.monitor; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.stable.fun.FunctionHelper; |
||||
import com.fr.stable.fun.impl.AbstractFunctionProcessor; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class MonitorPie extends AbstractFunctionProcessor { |
||||
|
||||
private static MonitorPie instance = new MonitorPie(); |
||||
|
||||
public static MonitorPie getInstance() { |
||||
return instance; |
||||
} |
||||
|
||||
@Override |
||||
public int getId() { |
||||
return FunctionHelper.generateFunctionID("com.fr.solution.plugin.chart.echarts"); |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return Inter.getLocText("Plugin-ECharts_Pie"); |
||||
} |
||||
} |
@ -0,0 +1,99 @@
|
||||
package com.fr.solution.plugin.chart.echarts.plot.pie; |
||||
|
||||
import com.fr.base.chart.chartdata.ChartData; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.chartdata.NormalChartData; |
||||
import com.fr.chart.chartglyph.PlotGlyph; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.solution.plugin.chart.echarts.glyph.pie.EChartsPiePlotGlyph; |
||||
import com.fr.solution.plugin.chart.echarts.monitor.MonitorPie; |
||||
import com.fr.solution.plugin.chart.echarts.plot.EChartsPlot; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.fun.FunctionProcessor; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class EChartsPiePlot extends EChartsPlot { |
||||
|
||||
|
||||
private PieType pieType; |
||||
|
||||
public EChartsPiePlot() { |
||||
this(PieType.REGULAR); |
||||
} |
||||
|
||||
public EChartsPiePlot(PieType pieType) { |
||||
this.pieType = pieType; |
||||
} |
||||
|
||||
public void setPieType(PieType pieType) { |
||||
this.pieType = pieType; |
||||
} |
||||
|
||||
@Override |
||||
public PlotGlyph createPlotGlyph(ChartData chartData) { |
||||
PlotGlyph glyph = new EChartsPiePlotGlyph(); |
||||
install4PlotGlyph(glyph, chartData); |
||||
return glyph; |
||||
} |
||||
|
||||
@Override |
||||
public String getPlotID() { |
||||
return "EChartsPiePlot"; |
||||
} |
||||
|
||||
@Override |
||||
public boolean matchPlotType(Plot newPlot) { |
||||
return newPlot instanceof EChartsPiePlot; |
||||
} |
||||
|
||||
@Override |
||||
public ChartData defaultChartData() { |
||||
return new NormalChartData(); |
||||
} |
||||
|
||||
@Override |
||||
public FunctionProcessor getFunctionToRecord() { |
||||
return MonitorPie.getInstance(); |
||||
} |
||||
|
||||
public boolean accept(Class<? extends Plot> obClass) { |
||||
return ComparatorUtils.equals(EChartsPiePlot.class, obClass); |
||||
} |
||||
|
||||
@Override |
||||
public String getPlotName() { |
||||
return Inter.getLocText("Plugin-ECharts_Pie"); |
||||
} |
||||
|
||||
protected void readPlotXML(XMLableReader reader) { |
||||
super.readPlotXML(reader); |
||||
if (reader.isChildNode()) { |
||||
String tagName = reader.getTagName(); |
||||
|
||||
if (tagName.equals("PieAttr4ECharts")) { |
||||
pieType = PieType.parse(reader.getAttrAsString("pieType", StringUtils.EMPTY)); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void writeXML(XMLPrintWriter writer) { |
||||
super.writeXML(writer); |
||||
writer.startTAG("PieAttr4ECharts"); |
||||
writer.attr("pieType", pieType.toTypeString()); |
||||
writer.end(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object ob) { |
||||
return ob instanceof EChartsPiePlot |
||||
&& super.equals(ob) |
||||
&& ComparatorUtils.equals(((EChartsPiePlot) ob).pieType, pieType); |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.solution.plugin.chart.echarts.plot.pie; |
||||
|
||||
import com.fr.general.ComparatorUtils; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public enum PieType { |
||||
|
||||
REGULAR("regular"), CIRCLE("circle"); |
||||
|
||||
private String type; |
||||
|
||||
PieType(String type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public String toTypeString() { |
||||
return type; |
||||
} |
||||
|
||||
private static PieType[] positions; |
||||
|
||||
/** |
||||
* 将字符串转换成枚举类型 |
||||
* @param p 待转换的整数 |
||||
* @return 枚举 |
||||
*/ |
||||
public static PieType parse(String p) { |
||||
if (positions == null) { |
||||
positions = PieType.values(); |
||||
} |
||||
for (PieType ip : positions) { |
||||
if (ComparatorUtils.equals(p, ip.type)) { |
||||
return ip; |
||||
} |
||||
} |
||||
return REGULAR; |
||||
} |
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.fr.solution.plugin.chart.echarts.title; |
||||
|
||||
import com.fr.chart.chartattr.Title; |
||||
import com.fr.solution.plugin.chart.echarts.glyph.EChartsTitleGlyph; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class EChartsTitle extends Title { |
||||
public static final String XML_TAG = "EChartsTitle"; |
||||
|
||||
@Override |
||||
public EChartsTitleGlyph createGlyph() { |
||||
return new EChartsTitleGlyph(); |
||||
} |
||||
} |
@ -1,16 +0,0 @@
|
||||
package com.fr.solution.plugin.chart.echarts.title; |
||||
|
||||
import com.fr.chart.chartattr.Title; |
||||
import com.fr.solution.plugin.chart.echarts.glyph.NewTitleGlyph; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class NewTitle extends Title { |
||||
public static final String XML_TAG = "NewTitle"; |
||||
|
||||
@Override |
||||
public NewTitleGlyph createGlyph() { |
||||
return new NewTitleGlyph(); |
||||
} |
||||
} |
@ -0,0 +1,73 @@
|
||||
package com.fr.solution.plugin.chart.echarts.ui; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.chartglyph.ConditionCollection; |
||||
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; |
||||
import com.fr.solution.plugin.chart.echarts.base.ECharts; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public abstract class AbstractEChartsTypePane extends AbstractChartTypePane{ |
||||
private static final long serialVersionUID = 7743244512351499265L; |
||||
|
||||
//新图表暂时还没有平面3d,渐变高光等布局。
|
||||
@Override |
||||
protected List<ChartImagePane> initStyleList() { |
||||
return new ArrayList<ChartImagePane>(); |
||||
} |
||||
|
||||
@Override |
||||
protected String[] getTypeLayoutPath() { |
||||
return new String[]{ |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 保存界面属性 |
||||
*/ |
||||
public void updateBean(Chart chart) { |
||||
checkTypeChange(); |
||||
Plot oldPlot = chart.getPlot(); |
||||
Plot newPlot = getSelectedClonedPlot(); |
||||
boolean samePlot = accept(chart); |
||||
if(typeChanged && samePlot){ |
||||
//同一中图表切换不同类型
|
||||
cloneOldPlot2New(oldPlot, newPlot); |
||||
chart.setPlot(newPlot); |
||||
} else if(!samePlot){ |
||||
//不同的图表类型切换
|
||||
chart.setPlot(newPlot); |
||||
} |
||||
} |
||||
|
||||
public boolean accept(Object ob) { |
||||
return ob instanceof ECharts; |
||||
} |
||||
|
||||
protected void checkTypeChange(){ |
||||
for(int i = 0; i < typeDemo.size(); i++){ |
||||
if(typeDemo.get(i).isPressing && i != lastTypeIndex){ |
||||
typeChanged = true; |
||||
lastTypeIndex = i; |
||||
break; |
||||
} |
||||
typeChanged = false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 同一个图表, 类型之间切换 |
||||
*/ |
||||
protected void cloneOldPlot2New(Plot oldPlot, Plot newPlot) { |
||||
|
||||
} |
||||
|
||||
protected void cloneOldConditionCollection(Plot oldPlot, Plot newPlot) throws CloneNotSupportedException{ |
||||
if (oldPlot.getConditionCollection() != null) { |
||||
newPlot.setConditionCollection((ConditionCollection)oldPlot.getConditionCollection().clone()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fr.solution.plugin.chart.echarts.ui; |
||||
|
||||
import com.fr.design.chart.fun.impl.AbstractIndependentChartUI; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public abstract class AbstractIndependentEChartsUI extends AbstractIndependentChartUI { |
||||
|
||||
@Override |
||||
public boolean isUseDefaultPane() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,10 @@
|
||||
package com.fr.solution.plugin.chart.echarts.ui.data; |
||||
|
||||
import com.fr.design.mainframe.chart.gui.data.report.CategoryPlotReportDataContentPane; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class AbstractEChartsReportDataContentPane extends CategoryPlotReportDataContentPane { |
||||
|
||||
} |
@ -0,0 +1,164 @@
|
||||
package com.fr.solution.plugin.chart.echarts.ui.data; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.chart.chartattr.Bar2DPlot; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartdata.NormalTableDataDefinition; |
||||
import com.fr.chart.chartdata.TopDefinition; |
||||
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.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.solution.plugin.chart.echarts.ui.series.NewSeriesTypeUsePane; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
/** |
||||
* Created by richie on 16/1/29. |
||||
*/ |
||||
public class AbstractEChartsTableDataContentPane extends AbstractTableDataContentPane { |
||||
|
||||
protected UIComboBox categoryComboBox; |
||||
protected NewSeriesTypeUsePane seriesTypeUsePane; |
||||
|
||||
|
||||
public AbstractEChartsTableDataContentPane(ChartDataPane parent) { |
||||
|
||||
categoryComboBox = new UIComboBox(); |
||||
JPanel categoryPane = new JPanel(new BorderLayout(4, 0)); |
||||
categoryPane.setBorder(BorderFactory.createMatteBorder(0, 0, 6, 1, getBackground())); |
||||
UILabel label1 = new BoldFontTextLabel(Inter.getLocText("FR-Chart-Category_Name") + ":", SwingConstants.RIGHT); |
||||
label1.setPreferredSize(new Dimension(75, 20)); |
||||
categoryComboBox.setPreferredSize(new Dimension(100, 20)); |
||||
|
||||
categoryComboBox.addItem(Inter.getLocText("Chart-Use_None")); |
||||
categoryPane.add(GUICoreUtils.createBorderLayoutPane(new Component[]{categoryComboBox, null, null, label1, null})); |
||||
|
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
this.add(categoryPane, BorderLayout.NORTH); |
||||
|
||||
seriesTypeUsePane = new NewSeriesTypeUsePane(parent, new Bar2DPlot()); |
||||
this.add(seriesTypeUsePane, BorderLayout.SOUTH); |
||||
|
||||
categoryComboBox.addItemListener(new ItemListener() { |
||||
public void itemStateChanged(ItemEvent e) { |
||||
checkSeriseUse(categoryComboBox.getSelectedItem() != null); |
||||
makeToolTipUse(categoryComboBox); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
protected void makeToolTipUse(UIComboBox comBox) { |
||||
if (comBox.getSelectedItem() != null) { |
||||
comBox.setToolTipText(comBox.getSelectedItem().toString()); |
||||
} else { |
||||
comBox.setToolTipText(null); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 检查 某些Box是否可用 |
||||
* |
||||
* @param hasUse 是否使用. |
||||
*/ |
||||
public void checkBoxUse(boolean hasUse) { |
||||
categoryComboBox.setEnabled(hasUse); |
||||
checkSeriseUse(hasUse); |
||||
} |
||||
|
||||
protected void checkSeriseUse(boolean hasUse) { |
||||
if (seriesTypeUsePane != null) { |
||||
seriesTypeUsePane.checkUseBox(hasUse && categoryComboBox.getSelectedItem() != null); |
||||
} |
||||
} |
||||
|
||||
protected void refreshBoxListWithSelectTableData(java.util.List list) { |
||||
refreshBoxItems(categoryComboBox, list); |
||||
categoryComboBox.addItem(Inter.getLocText("Chart-Use_None")); |
||||
|
||||
seriesTypeUsePane.refreshBoxListWithSelectTableData(list); |
||||
} |
||||
|
||||
/** |
||||
* 清空所有的box设置 |
||||
*/ |
||||
public void clearAllBoxList() { |
||||
clearBoxItems(categoryComboBox); |
||||
categoryComboBox.addItem(Inter.getLocText("Chart-Use_None")); |
||||
seriesTypeUsePane.clearAllBoxList(); |
||||
} |
||||
|
||||
/** |
||||
* 保存界面内容到ChartCollection |
||||
*/ |
||||
public void updateBean(ChartCollection collection) { |
||||
seriesTypeUsePane.updateBean(collection); |
||||
NormalTableDataDefinition dataDefinition = (NormalTableDataDefinition) collection.getSelectedChart().getFilterDefinition(); |
||||
if (dataDefinition == null) { |
||||
return; |
||||
} |
||||
Object categoryName = categoryComboBox.getSelectedItem(); |
||||
|
||||
if (ArrayUtils.contains(ChartConstants.NONE_KEYS, categoryName)) { |
||||
dataDefinition.setCategoryName(StringUtils.EMPTY); |
||||
} else { |
||||
dataDefinition.setCategoryName(categoryName == null ? null : categoryName.toString()); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 根据ChartCollection 更新界面 |
||||
*/ |
||||
public void populateBean(ChartCollection collection) { |
||||
super.populateBean(collection); |
||||
TopDefinition top = (TopDefinition) collection.getSelectedChart().getFilterDefinition(); |
||||
|
||||
if (!(top instanceof NormalTableDataDefinition)) { |
||||
return; |
||||
} |
||||
NormalTableDataDefinition data = (NormalTableDataDefinition) top; |
||||
|
||||
if (data == null || ComparatorUtils.equals(data.getCategoryName(), StringUtils.EMPTY)) { |
||||
categoryComboBox.setSelectedItem(Inter.getLocText("Chart-Use_None")); |
||||
} else if (data != null && !this.boxItemsContainsObject(categoryComboBox, data.getCategoryName())) { |
||||
categoryComboBox.setSelectedItem(null); |
||||
} else { |
||||
combineCustomEditValue(categoryComboBox, data == null ? null : data.getCategoryName()); |
||||
} |
||||
|
||||
seriesTypeUsePane.populateBean(collection, this.isNeedSummaryCaculateMethod()); |
||||
} |
||||
|
||||
private boolean boxItemsContainsObject(UIComboBox box, Object item) { |
||||
if (box == null) { |
||||
return false; |
||||
} |
||||
|
||||
ComboBoxModel dataModel = box.getModel(); |
||||
for (int i = 0; i < dataModel.getSize(); i++) { |
||||
if (ComparatorUtils.equals(dataModel.getElementAt(i), item)) { |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 重新布局整个面板 |
||||
*/ |
||||
public void redoLayoutPane() { |
||||
seriesTypeUsePane.relayoutPane(this.isNeedSummaryCaculateMethod()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.solution.plugin.chart.echarts.ui.filter; |
||||
|
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.style.ThirdTabPane; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class NewDataFilterPane extends ThirdTabPane<ChartCollection> { |
||||
|
||||
public NewDataFilterPane(Plot plot, ChartDataPane parent) { |
||||
super(plot, parent); |
||||
} |
||||
|
||||
@Override |
||||
protected List<NamePane> initPaneList(Plot plot, AbstractAttrNoScrollPane parent) { |
||||
List<NamePane> paneList = new ArrayList<NamePane>(); |
||||
return paneList; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ChartCollection ob) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -1,56 +1,14 @@
|
||||
package com.fr.solution.plugin.chart.echarts.ui.map; |
||||
|
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.design.event.UIObserver; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.gui.frpane.UICorrelationPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.List; |
||||
import com.fr.solution.plugin.chart.echarts.ui.data.AbstractEChartsTableDataContentPane; |
||||
|
||||
/** |
||||
* Created by richie on 16/1/29. |
||||
*/ |
||||
public class ChineseMapTableDataContentPane extends AbstractTableDataContentPane implements UIObserver { |
||||
|
||||
private UICorrelationPane correlationPane; |
||||
public class ChineseMapTableDataContentPane extends AbstractEChartsTableDataContentPane { |
||||
|
||||
public ChineseMapTableDataContentPane(ChartDataPane parent) { |
||||
setLayout(new BorderLayout()); |
||||
UILabel label = new UILabel("测试布局"); |
||||
setBorder(BorderFactory.createLineBorder(Color.RED)); |
||||
add(label, BorderLayout.NORTH); |
||||
correlationPane = new UICorrelationPane("区域名", "区域值"); |
||||
add(correlationPane, BorderLayout.CENTER); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(ChartCollection ob) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void clearAllBoxList() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected void refreshBoxListWithSelectTableData(List columnNameList) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void registerChangeListener(UIObserverListener listener) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public boolean shouldResponseChangeListener() { |
||||
return true; |
||||
super(parent); |
||||
} |
||||
} |
@ -0,0 +1,67 @@
|
||||
package com.fr.solution.plugin.chart.echarts.ui.pie; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.design.mainframe.chart.gui.type.ChartImagePane; |
||||
import com.fr.design.mainframe.chart.gui.type.UserDefinedChartTypePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.solution.plugin.chart.echarts.EChartsPie; |
||||
import com.fr.solution.plugin.chart.echarts.plot.pie.EChartsPiePlot; |
||||
import com.fr.solution.plugin.chart.echarts.ui.AbstractEChartsTypePane; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by richie on 16/1/29. |
||||
*/ |
||||
public class EChartsPieChartTypePane extends AbstractEChartsTypePane { |
||||
/** |
||||
* 弹出框的标题 |
||||
* |
||||
* @return 弹出框的标题 |
||||
*/ |
||||
public String title4PopupWindow() { |
||||
return Inter.getLocText("Plugin-ECharts_Pie"); |
||||
} |
||||
|
||||
public void updateBean(Chart chart) { |
||||
if (chart != null) { |
||||
chart.setPlot(new EChartsPiePlot()); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 界面是否接受 |
||||
* |
||||
* @param ob 对象是否为chart |
||||
* @return 界面是否接受对象 |
||||
*/ |
||||
public boolean accept(Object ob) { |
||||
return (ob instanceof Chart) && ((Chart) ob).getPlot().accept(EChartsPiePlot.class); |
||||
} |
||||
|
||||
@Override |
||||
public Chart getDefaultChart() { |
||||
return EChartsPie.charts[0]; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected List<ChartImagePane> initDemoList() { |
||||
List <ChartImagePane> demoList = new ArrayList<ChartImagePane>(); |
||||
String[] iconPaths = getTypeIconPath(); |
||||
ChartImagePane pane = new ChartImagePane(iconPaths[0], "Regular"); |
||||
pane.isPressing = true; |
||||
demoList.add(pane); |
||||
demoList.add(new ChartImagePane(iconPaths[1], "Circle")); |
||||
return demoList; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] getTypeIconPath() { |
||||
return new String[]{ |
||||
"/com/fr/solution/plugin/chart/echarts/images/pie/pie_type1.png", |
||||
"/com/fr/solution/plugin/chart/echarts/images/pie/pie_type2.png" |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,9 @@
|
||||
package com.fr.solution.plugin.chart.echarts.ui.pie; |
||||
|
||||
import com.fr.solution.plugin.chart.echarts.ui.data.AbstractEChartsReportDataContentPane; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class EChartsPieReportDataContentPane extends AbstractEChartsReportDataContentPane { |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fr.solution.plugin.chart.echarts.ui.pie; |
||||
|
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.solution.plugin.chart.echarts.ui.data.AbstractEChartsTableDataContentPane; |
||||
|
||||
/** |
||||
* Created by richie on 16/2/18. |
||||
*/ |
||||
public class EChartsPieTableDataContentPane extends AbstractEChartsTableDataContentPane { |
||||
|
||||
public EChartsPieTableDataContentPane(ChartDataPane parent) { |
||||
super(parent); |
||||
} |
||||
} |
@ -0,0 +1,159 @@
|
||||
package com.fr.solution.plugin.chart.echarts.ui.series; |
||||
|
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.chart.chartdata.MoreNameCDDefinition; |
||||
import com.fr.chart.chartdata.OneValueCDDefinition; |
||||
import com.fr.design.beans.FurtherBasicBeanPane; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.gui.frpane.UIComboBoxPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldNamePane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.SeriesNameUseFieldValuePane; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.solution.plugin.chart.echarts.ui.filter.NewDataFilterPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class NewSeriesTypeUsePane extends UIComboBoxPane<ChartCollection> { |
||||
|
||||
private SeriesNameUseFieldValuePane nameFieldValuePane; |
||||
private SeriesNameUseFieldNamePane nameFieldNamePane; |
||||
|
||||
private NewDataFilterPane dataFilterPane; |
||||
|
||||
private ChartDataPane parent; |
||||
private Plot initplot; |
||||
|
||||
private boolean isNeedSummary = true; |
||||
|
||||
public NewSeriesTypeUsePane(ChartDataPane parent, Plot initPlot) { |
||||
cards = initPaneList(); |
||||
this.parent = parent; |
||||
this.initplot = initPlot; |
||||
this.isNeedSummary = true; |
||||
initComponents(); |
||||
} |
||||
|
||||
protected void initLayout() { |
||||
this.setLayout(new BorderLayout(4, LayoutConstants.VGAP_MEDIUM)); |
||||
JPanel northPane = new JPanel(new BorderLayout(4, 0)); |
||||
UILabel label1 = new UILabel(Inter.getLocText("ChartF-Series_Name_From") + ":", SwingConstants.RIGHT); |
||||
label1.setPreferredSize(new Dimension(75, 20)); |
||||
northPane.add(GUICoreUtils.createBorderLayoutPane( |
||||
jcb, BorderLayout.CENTER, |
||||
label1, BorderLayout.WEST |
||||
)); |
||||
northPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1)); |
||||
add(northPane, BorderLayout.NORTH); |
||||
add(cardPane, BorderLayout.CENTER); |
||||
|
||||
dataFilterPane = new NewDataFilterPane(initplot, parent); |
||||
add(dataFilterPane, BorderLayout.SOUTH); |
||||
} |
||||
|
||||
/** |
||||
* 检查box 是否使用, hasUse, 表示上层已经使用, 否则, 则此界面都可使用 |
||||
* |
||||
* @param hasUse 是否使用 |
||||
*/ |
||||
public void checkUseBox(boolean hasUse) { |
||||
jcb.setEnabled(hasUse); |
||||
nameFieldValuePane.checkUse(hasUse); |
||||
} |
||||
|
||||
/** |
||||
* 切换 变更数据集时, 刷新Box选中项目 |
||||
* |
||||
* @param list 列表 |
||||
*/ |
||||
public void refreshBoxListWithSelectTableData(List list) { |
||||
nameFieldValuePane.refreshBoxListWithSelectTableData(list); |
||||
nameFieldNamePane.refreshBoxListWithSelectTableData(list); |
||||
} |
||||
|
||||
/** |
||||
* 清空所有的box设置 |
||||
*/ |
||||
public void clearAllBoxList() { |
||||
nameFieldValuePane.clearAllBoxList(); |
||||
nameFieldNamePane.clearAllBoxList(); |
||||
} |
||||
|
||||
/** |
||||
* 界面标题 |
||||
* |
||||
* @return 界面标题 |
||||
*/ |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("ChartF-Series_Name_From"); |
||||
} |
||||
|
||||
@Override |
||||
protected List<FurtherBasicBeanPane<? extends ChartCollection>> initPaneList() { |
||||
nameFieldValuePane = new SeriesNameUseFieldValuePane(); |
||||
nameFieldNamePane = new SeriesNameUseFieldNamePane(); |
||||
List<FurtherBasicBeanPane<? extends ChartCollection>> paneList = new ArrayList<FurtherBasicBeanPane<? extends ChartCollection>>(); |
||||
paneList.add(nameFieldValuePane); |
||||
paneList.add(nameFieldNamePane); |
||||
return paneList; |
||||
} |
||||
|
||||
public void populateBean(ChartCollection ob, boolean isNeedSummary) { |
||||
this.isNeedSummary = isNeedSummary; |
||||
TopDefinitionProvider definition = ob.getSelectedChart().getFilterDefinition(); |
||||
if (definition instanceof OneValueCDDefinition) { |
||||
this.setSelectedIndex(0); |
||||
nameFieldValuePane.populateBean(ob, isNeedSummary); |
||||
} else if (definition instanceof MoreNameCDDefinition) { |
||||
this.setSelectedIndex(1); |
||||
nameFieldNamePane.populateBean(ob, isNeedSummary); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 重新布局整个面板 |
||||
* |
||||
* @param isNeedSummary 是否需要汇总 |
||||
*/ |
||||
public void relayoutPane(boolean isNeedSummary) { |
||||
this.isNeedSummary = isNeedSummary; |
||||
if (jcb.getSelectedIndex() == 0) { |
||||
nameFieldValuePane.relayoutPane(this.isNeedSummary); |
||||
} else { |
||||
nameFieldNamePane.relayoutPane(this.isNeedSummary); |
||||
} |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void comboBoxItemStateChanged() { |
||||
if (jcb.getSelectedIndex() == 0) { |
||||
nameFieldValuePane.relayoutPane(this.isNeedSummary); |
||||
} else { |
||||
nameFieldNamePane.relayoutPane(this.isNeedSummary); |
||||
} |
||||
} |
||||
|
||||
public void populateBean(ChartCollection ob) { |
||||
this.populateBean(ob, true); |
||||
} |
||||
|
||||
/** |
||||
* 保存界面属性到Ob-ChartCollection |
||||
*/ |
||||
public void updateBean(ChartCollection ob) { |
||||
if (this.getSelectedIndex() == 0) { |
||||
nameFieldValuePane.updateBean(ob); |
||||
} else { |
||||
nameFieldNamePane.updateBean(ob); |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue