pioneer
2 years ago
commit
fb8cf7ff38
73 changed files with 9814 additions and 0 deletions
@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<project basedir="." default="jar" name="plugin"> |
||||
<!-- JDK路径,根据自己机器上实际位置修改--> |
||||
<property name="jdk.home" value="C:/Program Files/Java/jdk1.8.0_181"/> |
||||
|
||||
<property name="libs" value="${basedir}/lib"/> |
||||
<property name="publicLibs" value=""/> |
||||
<property name="reportLibs" value="${basedir}/../../webroot/WEB-INF/lib"/> |
||||
<property name="destLoc" value="."/> |
||||
<property name="classes" value="classes"/> |
||||
<xmlproperty file="${basedir}/plugin.xml"/> |
||||
<property name="current-version" value="${plugin.version}"/> |
||||
|
||||
<!-- 插件版本--> |
||||
<property name="plugin-version" value="${current-version}"/> |
||||
<!-- 插件名字--> |
||||
<property name="plugin-name" value="pielinecomb"/> |
||||
<property name="plugin-jar" value="fr-plugin-${plugin-name}-${plugin-version}.jar"/> |
||||
|
||||
<target name="prepare"> |
||||
<delete dir="${classes}"/> |
||||
<delete dir="fr-plugin-${plugin-name}-${plugin-version}"/> |
||||
<xmlproperty file="${basedir}/plugin.xml"/> |
||||
<delete dir="${destLoc}/${plugin.name}"/> |
||||
</target> |
||||
<path id="compile.classpath"> |
||||
<fileset dir="${libs}"> |
||||
<include name="**/*.jar"/> |
||||
</fileset> |
||||
<fileset dir="${publicLibs}"> |
||||
<include name="**/*.jar"/> |
||||
</fileset> |
||||
<fileset dir="${reportLibs}"> |
||||
<include name="**/*.jar"/> |
||||
</fileset> |
||||
</path> |
||||
<patternset id="resources4Jar"> |
||||
<exclude name="**/.settings/**"/> |
||||
<exclude name=".classpath"/> |
||||
<exclude name=".project"/> |
||||
|
||||
<exclude name="**/*.java"/> |
||||
<exclude name="**/*.db"/> |
||||
<exclude name="**/*.g"/> |
||||
<exclude name="**/package.html"/> |
||||
</patternset> |
||||
<target name="copy_resources"> |
||||
<echo message="从${resources_from}拷贝图片,JS,CSS等资源文件"/> |
||||
<delete dir="tmp"/> |
||||
<copy todir="tmp"> |
||||
<fileset dir="${resources_from}/src"> |
||||
<patternset refid="resources4Jar"/> |
||||
</fileset> |
||||
</copy> |
||||
<copy todir="${classes}"> |
||||
<fileset dir="tmp"/> |
||||
</copy> |
||||
<delete dir="tmp"/> |
||||
</target> |
||||
<target name="compile_javas"> |
||||
<echo message="编译${compile_files}下的Java文件"/> |
||||
<javac destdir="${classes}" debug="false" optimize="on" source="${source_jdk_version}" |
||||
target="${target_jdk_version}" |
||||
fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}" |
||||
executable="${compile_jdk_version}/bin/javac"> |
||||
<src path="${basedir}/src"/> |
||||
<exclude name="**/.svn/**"/> |
||||
<compilerarg line="-encoding UTF8 "/> |
||||
<classpath refid="compile.classpath"/> |
||||
</javac> |
||||
</target> |
||||
|
||||
<target name="jar_classes"> |
||||
<echo message="打Jar包:${jar_name}"/> |
||||
<delete file="${basedir}/${jar_name}"/> |
||||
<jar jarfile="${basedir}/${jar_name}"> |
||||
<fileset dir="${classes}"> |
||||
</fileset> |
||||
</jar> |
||||
</target> |
||||
|
||||
<target name="super_jar" depends="prepare"> |
||||
<antcall target="copy_resources"> |
||||
<param name="resources_from" value="${basedir}"/> |
||||
</antcall> |
||||
<antcall target="compile_javas"> |
||||
<param name="source_jdk_version" value="1.8"/> |
||||
<param name="target_jdk_version" value="1.8"/> |
||||
<param name="compile_jdk_version" value="${jdk.home}"/> |
||||
<param name="compile_files" value="${basedir}/src"/> |
||||
</antcall> |
||||
<echo message="compile plugin success!"/> |
||||
|
||||
<antcall target="jar_classes"> |
||||
<param name="jar_name" value="${plugin-jar}"/> |
||||
</antcall> |
||||
<delete dir="${classes}"/> |
||||
|
||||
</target> |
||||
|
||||
<target name="jar" depends="super_jar"> |
||||
<antcall target="zip"/> |
||||
</target> |
||||
|
||||
<target name="zip"> |
||||
<property name="plugin-folder" value="fr-plugin-${plugin-name}-${plugin-version}"/> |
||||
<echo message="----------zip files----------"/> |
||||
<mkdir dir="${plugin-folder}"/> |
||||
<copy todir="${plugin-folder}"> |
||||
<fileset dir="."> |
||||
<include name="${plugin-jar}"/> |
||||
<include name="plugin.xml"/> |
||||
</fileset> |
||||
<fileset dir="${libs}"> |
||||
<include name="*.jar"/> |
||||
<include name="*.dll"/> |
||||
</fileset> |
||||
</copy> |
||||
<zip destfile="${basedir}/${plugin-folder}.zip" basedir="."> |
||||
<include name="${plugin-folder}/*.jar"/> |
||||
<include name="${plugin-folder}/*.dll"/> |
||||
<include name="${plugin-folder}/plugin.xml"/> |
||||
</zip> |
||||
<xmlproperty file="${basedir}/plugin.xml"/> |
||||
<move file="${plugin-folder}.zip" todir="${destLoc}/install"/> |
||||
<delete file="fr-plugin-${plugin-name}-${plugin-version}.jar"/> |
||||
</target> |
||||
</project> |
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<plugin> |
||||
<main-package>com.fr.plugin.pielinecomb</main-package> |
||||
<id>com.fr.plugin.pielinecomb.v10</id> |
||||
<name><![CDATA[柱形折线组合图_定制_EK]]></name> |
||||
<active>yes</active> |
||||
<version>1.0.3</version> |
||||
<env-version>10.0~11.0</env-version> |
||||
<jartime>2021-04-24</jartime> |
||||
<vendor email="857015985@qq.com">xiaobaosuccess</vendor> |
||||
<description><![CDATA[<p>柱形折线组合图_定制_EK</p>]]></description> |
||||
<change-notes><![CDATA[<p>[2022-10-18]开发1.0版本</p>]]></change-notes> |
||||
<extra-report/> |
||||
<extra-designer/> |
||||
<extra-platform/> |
||||
<extra-core> |
||||
<LocaleFinder class="com.fr.plugin.pielinecomb.PieLineCombChartLocaleFinder"/> |
||||
</extra-core> |
||||
<extra-chart> |
||||
<IndependentChartProvider class="com.fr.plugin.pielinecomb.PieLineCombChartProvider" |
||||
plotID="PieLineCombChart"/> |
||||
</extra-chart> |
||||
<extra-chart-designer> |
||||
<IndependentChartUIProvider class="com.fr.plugin.pielinecomb.PieLineCombChartUI" |
||||
plotID="PieLineCombChart"/> |
||||
</extra-chart-designer> |
||||
<function-recorder class="com.fr.plugin.pielinecomb.PieLineCombChart"/> |
||||
</plugin> |
@ -0,0 +1,913 @@
|
||||
package com.fr.plugin.pielinecomb; |
||||
|
||||
import com.bulenkov.iconloader.util.Base64Converter; |
||||
import com.fr.base.Base64; |
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.data.core.FormatField; |
||||
import com.fr.extended.chart.*; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.xml.GeneralXMLTools; |
||||
import com.fr.js.NameJavaScriptGroup; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.pielinecomb.comp.AbstractCustomChart; |
||||
import com.fr.plugin.pielinecomb.comp.WebPageRender; |
||||
import com.fr.plugin.pielinecomb.data.DataUtils; |
||||
import com.fr.plugin.pielinecomb.data.LineDataConfig; |
||||
import com.fr.plugin.pielinecomb.data.PieDataConfig; |
||||
import com.fr.plugin.pielinecomb.vo.HyperLinkObject; |
||||
import com.fr.plugin.transform.ExecuteFunctionRecord; |
||||
import com.fr.plugin.transform.FunctionRecorder; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.stable.AssistUtils; |
||||
import com.fr.stable.StableUtils; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.web.Repository; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
import java.awt.image.BufferedImage; |
||||
import java.io.UnsupportedEncodingException; |
||||
import java.math.RoundingMode; |
||||
import java.text.Format; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/8/19 |
||||
*/ |
||||
@FunctionRecorder |
||||
public class PieLineCombChart extends AbstractCustomChart<AbstractDataConfig> { |
||||
|
||||
private static final String ID = "PieLineCombChart"; |
||||
private static final String NAME = "柱形折线组合图_定制_EK"; |
||||
|
||||
private static String BASE64_CHART_IMG = ""; |
||||
|
||||
/** |
||||
* 图表类型 |
||||
* */ |
||||
private int chartType; |
||||
/** |
||||
* 数据集类型 |
||||
* */ |
||||
private String dataType; |
||||
|
||||
public static String PIE_DATA = "PieData"; |
||||
public static String LINE_DATA = "LineData"; |
||||
|
||||
private JSONObject titleConf; |
||||
private JSONObject legendConf; |
||||
private JSONObject labelConf; |
||||
private JSONObject seriesConf; |
||||
private JSONObject axisConf; |
||||
private JSONObject tipsConf; |
||||
private JSONObject bgConf; |
||||
|
||||
private JSONObject styleCond; |
||||
private HyperLinkObject linkConf; |
||||
|
||||
private StringFormula titleName; |
||||
|
||||
@Override |
||||
protected String getChartID() { |
||||
return ID; |
||||
} |
||||
|
||||
@Override |
||||
public String getChartName() { |
||||
return NAME; |
||||
} |
||||
|
||||
@ExecuteFunctionRecord |
||||
@Override |
||||
protected void addJSON(AbstractDataConfig dataConfig, JSONObject jsonObject, Repository repository, JSONPara jsonPara) throws JSONException { |
||||
|
||||
//Format format = getDataFormat(getAxisConf().getInt("xformattype"), getAxisConf().getString("xformatstr"));
|
||||
//String k = format.format(35666.666666D);
|
||||
|
||||
JSONObject title = getTitleConf(); |
||||
title.put("titlename", this.titleName.getResult()); |
||||
|
||||
jsonObject.put("titleConf", title); |
||||
jsonObject.put("legendConf", getLegendConf()); |
||||
jsonObject.put("labelConf", getLabelConf()); |
||||
jsonObject.put("seriesConf", getSeriesConf()); |
||||
jsonObject.put("axisConf", getAxisConf()); |
||||
jsonObject.put("tipsConf", getTipsConf()); |
||||
jsonObject.put("bgConf", getBgConf()); |
||||
jsonObject.put("styleCond", getStyleCond()); |
||||
|
||||
addAutoLinkJSON(jsonObject, jsonPara); |
||||
|
||||
jsonObject.put("data", makeChartData()); |
||||
} |
||||
|
||||
private JSONObject makeChartData() { |
||||
|
||||
PieDataConfig pieData = DataUtils.getDataConfig(PieLineCombChart.PIE_DATA, this); |
||||
LineDataConfig lineData = DataUtils.getDataConfig(PieLineCombChart.LINE_DATA, this); |
||||
|
||||
JSONObject jsonObject = JSONObject.create(); |
||||
if (chartType == 0) { |
||||
JSONObject pieDataConf = makeSingleData(pieData, "pie"); |
||||
JSONArray pieAxisXData = pieDataConf.getJSONArray("xAxisData"); |
||||
JSONArray pieAxisXLabelData = JSONArray.create(); |
||||
for (int i = 0; i < pieAxisXData.size(); i++) { |
||||
Format format = getDataFormat(getAxisConf().getInt("xformattype"), getAxisConf().getString("xformatstr")); |
||||
try { |
||||
String label = format.format(pieAxisXData.get(i)); |
||||
pieAxisXLabelData.put(label); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
pieAxisXLabelData.put(pieAxisXData.get(i)); |
||||
} |
||||
} |
||||
pieDataConf.put("xAxisLabelData", pieAxisXLabelData); |
||||
jsonObject.put("pie", pieDataConf); |
||||
} else if (chartType == 1) { |
||||
JSONObject pieDataConf = makeSingleData(lineData, "line"); |
||||
JSONArray pieAxisXData = pieDataConf.getJSONArray("xAxisData"); |
||||
JSONArray pieAxisXLabelData = JSONArray.create(); |
||||
for (int i = 0; i < pieAxisXData.size(); i++) { |
||||
Format format = getDataFormat(getAxisConf().getInt("xformattype"), getAxisConf().getString("xformatstr")); |
||||
try { |
||||
String label = format.format(pieAxisXData.get(i)); |
||||
pieAxisXLabelData.put(label); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
pieAxisXLabelData.put(pieAxisXData.get(i)); |
||||
} |
||||
} |
||||
pieDataConf.put("xAxisLabelData", pieAxisXLabelData); |
||||
jsonObject.put("line", pieDataConf); |
||||
} else { |
||||
JSONObject pieDataConf = makeSingleData(pieData, "pie"); |
||||
JSONArray pieAxisXData = pieDataConf.getJSONArray("xAxisData"); |
||||
JSONArray pieAxisXLabelData = JSONArray.create(); |
||||
for (int i = 0; i < pieAxisXData.size(); i++) { |
||||
Format format = getDataFormat(getAxisConf().getInt("xformattype"), getAxisConf().getString("xformatstr")); |
||||
try { |
||||
String label = format.format(pieAxisXData.get(i)); |
||||
pieAxisXLabelData.put(label); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().warn("Data Format error!"); |
||||
pieAxisXLabelData.put(pieAxisXData.get(i)); |
||||
} |
||||
} |
||||
pieDataConf.put("xAxisLabelData", pieAxisXLabelData); |
||||
jsonObject.put("pie", pieDataConf); |
||||
|
||||
pieDataConf = makeSingleData(lineData, "line"); |
||||
pieAxisXData = pieDataConf.getJSONArray("xAxisData"); |
||||
pieAxisXLabelData = JSONArray.create(); |
||||
for (int i = 0; i < pieAxisXData.size(); i++) { |
||||
Format format = getDataFormat(getAxisConf().getJSONObject("axisX").getInt("xformattype"), getAxisConf().getJSONObject("axisX").getString("xformatstr")); |
||||
try { |
||||
String label = format.format(pieAxisXData.get(i)); |
||||
pieAxisXLabelData.put(label); |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
pieAxisXLabelData.put(pieAxisXData.get(i)); |
||||
} |
||||
} |
||||
pieDataConf.put("xAxisLabelData", pieAxisXLabelData); |
||||
jsonObject.put("line", pieDataConf); |
||||
} |
||||
|
||||
return jsonObject; |
||||
} |
||||
|
||||
private JSONObject makeSingleData(AbstractDataConfig dataConfig, String dataName) { |
||||
JSONObject jsonObject = JSONObject.create(); |
||||
boolean isCustomName = false; |
||||
ExtendedField categoryField = null; |
||||
ExtendedField gridLineField = null; |
||||
ExtendedField regionColorField = null; |
||||
List<ExtendedField> customList = null; |
||||
ExtendedField customName = null; |
||||
ExtendedField customValue = null; |
||||
|
||||
if ("pie".equals(dataName)) { |
||||
PieDataConfig pieData = (PieDataConfig)dataConfig; |
||||
isCustomName = pieData.isCustomName(); |
||||
categoryField = pieData.getCategory(); |
||||
gridLineField = pieData.getGridline(); |
||||
regionColorField = pieData.getRegioncolor(); |
||||
customList = pieData.getCustomFields(); |
||||
customName = pieData.getCustomNameField(); |
||||
customValue = pieData.getCustomValueField(); |
||||
} else if ("line".equals(dataName)) { |
||||
LineDataConfig lineData = (LineDataConfig)dataConfig; |
||||
isCustomName = lineData.isCustomName(); |
||||
categoryField = lineData.getCategory(); |
||||
gridLineField = lineData.getGridline(); |
||||
regionColorField = lineData.getRegioncolor(); |
||||
customList = lineData.getCustomFields(); |
||||
customName = lineData.getCustomNameField(); |
||||
customValue = lineData.getCustomValueField(); |
||||
} |
||||
if (isCustomName) { |
||||
if (null != customList && customList.size() > 0) { |
||||
JSONObject seriesObj = JSONObject.create(); |
||||
JSONObject seriesObjIdx = JSONObject.create(); |
||||
JSONArray gridLineData = JSONArray.create(); |
||||
JSONObject regionColorData = JSONObject.create(); |
||||
for (int i = 0; i < customList.size(); i++) { |
||||
ExtendedField customField = customList.get(i); |
||||
List categorys = categoryField.getValues(); |
||||
List values = customField.getValues(); |
||||
List gridLines = null == gridLineField ? null : gridLineField.getValues(); |
||||
List regionColors = null == regionColorField ? null : regionColorField.getValues(); |
||||
JSONArray seriesData = JSONArray.create(); |
||||
int subEndIdx = customList.get(0).getValues().size(); |
||||
for (int k = 0; k < subEndIdx; k++) { |
||||
JSONArray seriesItem = JSONArray.create(); |
||||
seriesItem.put(categorys.get(k)); |
||||
seriesItem.put(values.get(k)); |
||||
seriesData.put(seriesItem); |
||||
if (i == 0 && null != gridLines && null != gridLines.get(k) |
||||
&& StringUtils.isNotEmpty(gridLines.get(k).toString())) { |
||||
gridLineData.put(categorys.get(k)); |
||||
} |
||||
if (i == 0 && null != regionColors && null != regionColors.get(k) |
||||
&& StringUtils.isNotEmpty(regionColors.get(k).toString())) { |
||||
regionColorData.put(categorys.get(k).toString(), regionColors.get(k)); |
||||
} |
||||
} |
||||
seriesObj.put(customField.getCustomName(), seriesData); |
||||
seriesObjIdx.put(customField.getCustomName(), i); |
||||
} |
||||
int subEndIdx = customList.get(0).getValues().size(); |
||||
jsonObject.put("xAxisData", JSONArray.create(categoryField.getValues().subList(0, subEndIdx))); |
||||
jsonObject.put("gridLine", gridLineData); |
||||
jsonObject.put("regionColor", regionColorData); |
||||
jsonObject.put("seriesData", seriesObj); |
||||
jsonObject.put("seriesIndex", seriesObjIdx); |
||||
} |
||||
} else { |
||||
List<Object> category = categoryField.getValues(); |
||||
List<Object> gridLine = null == gridLineField ? null : gridLineField.getValues(); |
||||
List<Object> regionColor = null == regionColorField ? null : regionColorField.getValues(); |
||||
List<Object> name = customName.getValues(); |
||||
List<Object> value = customValue.getValues(); |
||||
if (null != category && category.size() > 0) { |
||||
JSONObject seriesObj = JSONObject.create(); |
||||
JSONObject seriesObjIdx = JSONObject.create(); |
||||
if (null != name && name.size() > 0) { |
||||
// 用字段值
|
||||
List<Object> categoryNoDup = category.stream().distinct().collect(Collectors.toList()); |
||||
List<Object> nameNoDup = name.stream().distinct().collect(Collectors.toList()); |
||||
if (nameNoDup.size() > 1) { |
||||
// 多系列
|
||||
JSONArray gridLineData = JSONArray.create(); |
||||
JSONObject regionColorData = JSONObject.create(); |
||||
for (int i = 0; i < nameNoDup.size(); i++) { |
||||
JSONArray tmpSeries = JSONArray.create(); |
||||
for (int j = 0; j <categoryNoDup.size(); j++) { |
||||
|
||||
for (int k = 0; k < value.size(); k++) { |
||||
if (categoryNoDup.get(j).equals(category.get(k)) |
||||
&& nameNoDup.get(i).equals(name.get(k))) { |
||||
JSONArray seriesItem = JSONArray.create(); |
||||
seriesItem.put(category.get(k)); |
||||
seriesItem.put(value.get(k)); |
||||
tmpSeries.put(seriesItem); |
||||
|
||||
if (i == 0 && null != gridLine && null != gridLine.get(k) |
||||
&& StringUtils.isNotEmpty(gridLine.get(k).toString())) { |
||||
gridLineData.put(category.get(k)); |
||||
} |
||||
if (i == 0 && null != regionColor && null != regionColor.get(k) |
||||
&& StringUtils.isNotEmpty(regionColor.get(k).toString())) { |
||||
regionColorData.put(category.get(k).toString(), regionColor.get(k)); |
||||
} |
||||
break; |
||||
} |
||||
|
||||
} |
||||
} |
||||
seriesObj.put(nameNoDup.get(i).toString(), tmpSeries); |
||||
seriesObjIdx.put(nameNoDup.get(i).toString(), i); |
||||
} |
||||
jsonObject.put("seriesData", seriesObj); |
||||
jsonObject.put("xAxisData", JSONArray.create(categoryNoDup)); |
||||
jsonObject.put("gridLine", gridLineData); |
||||
jsonObject.put("regionColor", regionColorData); |
||||
jsonObject.put("seriesIndex", seriesObjIdx); |
||||
} else { |
||||
JSONArray seriesData = JSONArray.create(); |
||||
JSONArray gridLineData = JSONArray.create(); |
||||
JSONObject regionColorData = JSONObject.create(); |
||||
for (int k = 0; k < category.size(); k++) { |
||||
JSONArray seriesItem = JSONArray.create(); |
||||
seriesItem.put(category.get(k)); |
||||
seriesItem.put(value.get(k)); |
||||
seriesData.put(seriesItem); |
||||
|
||||
if (null != gridLine && null != gridLine.get(k) |
||||
&& StringUtils.isNotEmpty(gridLine.get(k).toString())) { |
||||
gridLineData.put(category.get(k)); |
||||
} |
||||
if (null != regionColor && null != regionColor.get(k) |
||||
&& StringUtils.isNotEmpty(regionColor.get(k).toString())) { |
||||
regionColorData.put(category.get(k).toString(), regionColor.get(k)); |
||||
} |
||||
} |
||||
seriesObj.put(nameNoDup.get(0).toString(), seriesData); |
||||
seriesObjIdx.put(nameNoDup.get(0).toString(), 0); |
||||
jsonObject.put("xAxisData", JSONArray.create(category)); |
||||
jsonObject.put("gridLine", gridLineData); |
||||
jsonObject.put("regionColor", regionColorData); |
||||
jsonObject.put("seriesData", seriesObj); |
||||
jsonObject.put("seriesIndex", seriesObjIdx); |
||||
} |
||||
|
||||
} else if (null != value && value.size() > 0 && value.size() == category.size()) { |
||||
|
||||
JSONArray seriesData = JSONArray.create(); |
||||
JSONArray gridLineData = JSONArray.create(); |
||||
JSONObject regionColorData = JSONObject.create(); |
||||
for (int k = 0; k < category.size(); k++) { |
||||
JSONArray seriesItem = JSONArray.create(); |
||||
seriesItem.put(category.get(k)); |
||||
seriesItem.put(value.get(k)); |
||||
seriesData.put(seriesItem); |
||||
|
||||
if (null != gridLine && null != gridLine.get(k) |
||||
&& StringUtils.isNotEmpty(gridLine.get(k).toString())) { |
||||
gridLineData.put(category.get(k)); |
||||
} |
||||
if (null != regionColor && null != regionColor.get(k) |
||||
&& StringUtils.isNotEmpty(regionColor.get(k).toString())) { |
||||
regionColorData.put(category.get(k).toString(), regionColor.get(k)); |
||||
} |
||||
} |
||||
seriesObj.put("default", seriesData); |
||||
seriesObjIdx.put("default", 0); |
||||
jsonObject.put("xAxisData", JSONArray.create(category)); |
||||
jsonObject.put("gridLine", gridLineData); |
||||
jsonObject.put("regionColor", regionColorData); |
||||
jsonObject.put("seriesData", seriesObj); |
||||
jsonObject.put("seriesIndex", seriesObjIdx); |
||||
} else { |
||||
FineLoggerFactory.getLogger().error("PieLineCombChart data config error!"); |
||||
} |
||||
} |
||||
} |
||||
return jsonObject; |
||||
} |
||||
|
||||
@Override |
||||
protected BufferedImage getChartImage(Calculator cal, int width, int height) { |
||||
BufferedImage image = null; |
||||
try { |
||||
synchronized (this) { |
||||
|
||||
JSONObject jsonObject = JSONObject.create(); |
||||
|
||||
jsonObject.put("data", makeChartData()); |
||||
|
||||
jsonObject.put("titleConf", getTitleConf()); |
||||
jsonObject.put("legendConf", getLegendConf()); |
||||
jsonObject.put("labelConf", getLabelConf()); |
||||
jsonObject.put("seriesConf", getSeriesConf()); |
||||
jsonObject.put("axisConf", getAxisConf()); |
||||
jsonObject.put("tipsConf", getTipsConf()); |
||||
jsonObject.put("bgConf", getBgConf()); |
||||
jsonObject.put("styleCond", getStyleCond()); |
||||
|
||||
if (StringUtils.isNotEmpty(BASE64_CHART_IMG) && !WebPageRender.getInstance().isDataChanged(jsonObject)) { |
||||
image = (BufferedImage) GeneralXMLTools.imageDecode(Base64Converter.decode(BASE64_CHART_IMG.getBytes())); |
||||
} else { |
||||
String imgStr = WebPageRender.getInstance().makeChartImage(jsonObject, width, height); |
||||
if (StringUtils.isNotEmpty(imgStr)) { |
||||
BASE64_CHART_IMG = imgStr; |
||||
image = (BufferedImage) GeneralXMLTools.imageDecode(Base64Converter.decode(imgStr.getBytes())); |
||||
} else { |
||||
image = super.getDemoImage(); |
||||
} |
||||
} |
||||
} |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
image = super.getDemoImage(); |
||||
} |
||||
return image; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] requiredJS() { |
||||
return new String[]{ |
||||
"com/fr/plugin/pielinecomb/web/PieLineCombChartWrapper.js" |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String wrapperName() { |
||||
return "PieLineCombChartWrapper"; |
||||
} |
||||
|
||||
private void addAutoLinkJSON(JSONObject paramJSONObject, JSONPara paramAbstractChart) |
||||
throws JSONException { |
||||
if (null != this.getLinkConf()) { |
||||
NameJavaScriptGroup pieNameGroup = this.getLinkConf().getNameJavaScriptGroup(HyperLinkObject.CHART_TYPE_PIE); |
||||
if (null != pieNameGroup) { |
||||
ToHyperlinkJSONHelper.addECNameToLinkGroup(paramAbstractChart.ecName, paramAbstractChart.sheetIndex, pieNameGroup); |
||||
paramJSONObject.put(HyperLinkObject.CHART_TYPE_PIE, ToHyperlinkJSONHelper.addAutoLinkJSON(pieNameGroup, hyperLinkParas())); |
||||
} |
||||
|
||||
NameJavaScriptGroup lineNameGroup = this.getLinkConf().getNameJavaScriptGroup(HyperLinkObject.CHART_TYPE_LINE); |
||||
if (null != lineNameGroup) { |
||||
ToHyperlinkJSONHelper.addECNameToLinkGroup(paramAbstractChart.ecName, paramAbstractChart.sheetIndex, lineNameGroup); |
||||
paramJSONObject.put(HyperLinkObject.CHART_TYPE_LINE, ToHyperlinkJSONHelper.addAutoLinkJSON(lineNameGroup, hyperLinkParas())); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public NameJavaScriptGroup getHotHyperlink(String s) { |
||||
return this.getLinkConf().getNameJavaScriptGroup(s); |
||||
} |
||||
|
||||
@Override |
||||
protected HyperLinkPara[] hyperLinkParas() { |
||||
return new HyperLinkPara[]{ |
||||
new HyperLinkPara() { |
||||
@Override |
||||
public String getName() { |
||||
return "分类名"; |
||||
} |
||||
|
||||
@Override |
||||
public String getFormulaContent() { |
||||
return "CATEGORY"; |
||||
} |
||||
|
||||
@Override |
||||
public String[] getProps() { |
||||
return new String[]{"category"}; |
||||
} |
||||
}, |
||||
new HyperLinkPara() { |
||||
@Override |
||||
public String getName() { |
||||
return "系列名"; |
||||
} |
||||
|
||||
@Override |
||||
public String getFormulaContent() { |
||||
return "SERIES"; |
||||
} |
||||
|
||||
@Override |
||||
public String[] getProps() { |
||||
return new String[]{"series"}; |
||||
} |
||||
}, |
||||
new HyperLinkPara() { |
||||
@Override |
||||
public String getName() { |
||||
return "数值"; |
||||
} |
||||
|
||||
@Override |
||||
public String getFormulaContent() { |
||||
return "VALUE"; |
||||
} |
||||
|
||||
@Override |
||||
public String[] getProps() { |
||||
return new String[]{"value"}; |
||||
} |
||||
} |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected void readAttr(XMLableReader xmLableReader) { |
||||
super.readAttr(xmLableReader); |
||||
this.chartType = xmLableReader.getAttrAsInt("chartType", 0); |
||||
String jsonStr = xmLableReader.getAttrAsString("dataType", ""); |
||||
if (StringUtils.isNotEmpty(jsonStr)) { |
||||
this.setDataType(jsonStr); |
||||
} |
||||
|
||||
jsonStr = xmLableReader.getAttrAsString("titleConf", ""); |
||||
if (StringUtils.isNotEmpty(jsonStr)) { |
||||
this.setTitleConf(new JSONObject(jsonStr)); |
||||
} |
||||
|
||||
jsonStr = xmLableReader.getAttrAsString("legendConf", ""); |
||||
if (StringUtils.isNotEmpty(jsonStr)) { |
||||
this.setLegendConf(new JSONObject(jsonStr)); |
||||
} |
||||
|
||||
jsonStr = xmLableReader.getAttrAsString("labelConf", ""); |
||||
if (StringUtils.isNotEmpty(jsonStr)) { |
||||
this.setLabelConf(new JSONObject(jsonStr)); |
||||
} |
||||
|
||||
jsonStr = xmLableReader.getAttrAsString("seriesConf", ""); |
||||
if (StringUtils.isNotEmpty(jsonStr)) { |
||||
this.setSeriesConf(new JSONObject(jsonStr)); |
||||
} |
||||
|
||||
try { |
||||
jsonStr = xmLableReader.getAttrAsString("axisConf", ""); |
||||
if (StringUtils.isNotEmpty(jsonStr)) { |
||||
this.setAxisConf(new JSONObject(new String(Base64.decode(jsonStr), "UTF-8"))); |
||||
} |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().warn(e.getMessage(), e); |
||||
} |
||||
|
||||
jsonStr = xmLableReader.getAttrAsString("tipsConf", ""); |
||||
if (StringUtils.isNotEmpty(jsonStr)) { |
||||
this.setTipsConf(new JSONObject(jsonStr)); |
||||
} |
||||
|
||||
jsonStr = xmLableReader.getAttrAsString("bgConf", ""); |
||||
if (StringUtils.isNotEmpty(jsonStr)) { |
||||
this.setBgConf(new JSONObject(jsonStr)); |
||||
} |
||||
|
||||
try { |
||||
jsonStr = xmLableReader.getAttrAsString("styleCond", ""); |
||||
if (StringUtils.isNotEmpty(jsonStr)) { |
||||
this.setStyleCond(new JSONObject(new String(Base64.decode(jsonStr), "UTF-8"))); |
||||
} |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().warn(e.getMessage(), e); |
||||
} |
||||
|
||||
if (null == linkConf) { |
||||
linkConf = (HyperLinkObject) xmLableReader.readXMLObject(new HyperLinkObject()); |
||||
} |
||||
|
||||
this.titleName = new StringFormula(this.getTitleConf().getString("titlename")); |
||||
} |
||||
|
||||
@Override |
||||
protected void writeAttr(XMLPrintWriter xmlPrintWriter) { |
||||
super.writeAttr(xmlPrintWriter); |
||||
xmlPrintWriter.attr("chartType", chartType); |
||||
if (null != dataType) { |
||||
xmlPrintWriter.attr("dataType", dataType); |
||||
} |
||||
if (null != titleConf) { |
||||
xmlPrintWriter.attr("titleConf", titleConf.toString()); |
||||
} |
||||
if (null != legendConf) { |
||||
xmlPrintWriter.attr("legendConf", legendConf.toString()); |
||||
} |
||||
if (null != labelConf) { |
||||
xmlPrintWriter.attr("labelConf", labelConf.toString()); |
||||
} |
||||
if (null != seriesConf) { |
||||
xmlPrintWriter.attr("seriesConf", seriesConf.toString()); |
||||
} |
||||
if (null != axisConf) { |
||||
try { |
||||
xmlPrintWriter.attr("axisConf", Base64.encode(axisConf.toString().getBytes("UTF-8"))); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().warn(e.getMessage(), e); |
||||
} |
||||
} |
||||
if (null != tipsConf) { |
||||
xmlPrintWriter.attr("tipsConf", tipsConf.toString()); |
||||
} |
||||
if (null != bgConf) { |
||||
xmlPrintWriter.attr("bgConf", bgConf.toString()); |
||||
} |
||||
|
||||
if (null != styleCond) { |
||||
try { |
||||
xmlPrintWriter.attr("styleCond", Base64.encode(styleCond.toString().getBytes("UTF-8"))); |
||||
} catch (Exception e) { |
||||
FineLoggerFactory.getLogger().warn(e.getMessage(), e); |
||||
} |
||||
} |
||||
|
||||
if (null != linkConf) { |
||||
linkConf.writeXML(xmlPrintWriter); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object o) { |
||||
boolean isEq = super.equals(o) |
||||
&& o instanceof PieLineCombChart |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getDataType(), this.dataType) |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getChartType(), this.chartType) |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getTitleConf(), this.titleConf) |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getLegendConf(), this.legendConf) |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getLabelConf(), this.labelConf) |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getSeriesConf(), this.seriesConf) |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getAxisConf(), this.axisConf) |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getTipsConf(), this.tipsConf) |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getBgConf(), this.bgConf) |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getStyleCond(), this.styleCond) |
||||
&& ComparatorUtils.equals(((PieLineCombChart) o).getLinkConf(), this.linkConf) |
||||
; |
||||
return isEq; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
return super.hashCode() + AssistUtils.hashCode(new Object[]{this.dataType, this.chartType, this.titleConf, this.legendConf, this.labelConf, this.seriesConf, this.axisConf, this.tipsConf, this.bgConf, this.styleCond, this.linkConf}); |
||||
} |
||||
|
||||
@Override |
||||
public PieLineCombChart clone() throws CloneNotSupportedException { |
||||
PieLineCombChart chart = (PieLineCombChart)super.clone(); |
||||
if (this.linkConf != null) { |
||||
chart.setLinkConf((HyperLinkObject) this.getLinkConf().clone()); |
||||
} |
||||
return chart; |
||||
} |
||||
|
||||
@Override |
||||
protected List<StringFormula> formulas() { |
||||
List<StringFormula> formulaList = new ArrayList<StringFormula>(); |
||||
formulaList.add(this.titleName); |
||||
return formulaList; |
||||
} |
||||
|
||||
@Override |
||||
protected String demoImagePath() { |
||||
return "com/fr/plugin/pielinecomb/images/demo.png"; |
||||
} |
||||
|
||||
public Format getDataFormat(Integer type, String formatStr) { |
||||
if (type == 7) { |
||||
return FormatField.getInstance().getFormat(type, formatStr); |
||||
} else if (StringUtils.isNotEmpty(formatStr)) { |
||||
return FormatField.getInstance().getFormat(type, formatStr, RoundingMode.HALF_EVEN); |
||||
} else { |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
public int getChartType() { |
||||
return chartType; |
||||
} |
||||
|
||||
public void setChartType(int chartType) { |
||||
this.chartType = chartType; |
||||
} |
||||
|
||||
public String getDataType() { |
||||
return dataType; |
||||
} |
||||
|
||||
public void setDataType(String dataType) { |
||||
this.dataType = dataType; |
||||
} |
||||
|
||||
public JSONObject getTitleConf() { |
||||
if (null == titleConf) { |
||||
titleConf = new JSONObject(); |
||||
titleConf.put("titlevisiable", true); |
||||
titleConf.put("titlename", "组合图"); |
||||
titleConf.put("titleposition", 0); |
||||
titleConf.put("titlesize", 16); |
||||
titleConf.put("titlestyle", 1); |
||||
titleConf.put("titlefamily", "微软雅黑"); |
||||
titleConf.put("titlecolor", "#333300"); |
||||
titleConf.put("titlebgcolor", "transparent"); |
||||
titleConf.put("titleBgOpacity", 100); |
||||
} |
||||
return titleConf; |
||||
} |
||||
|
||||
public void setTitleConf(JSONObject titleConf) { |
||||
this.titleConf = titleConf; |
||||
} |
||||
|
||||
public JSONObject getLegendConf() { |
||||
if (null == legendConf) { |
||||
legendConf = new JSONObject(); |
||||
legendConf.put("legendalignment", 4); |
||||
legendConf.put("legendcolor", "#000000"); |
||||
legendConf.put("legendfamily", "微软雅黑"); |
||||
legendConf.put("legendmargin", 20); |
||||
legendConf.put("legendposition", 1); |
||||
legendConf.put("legendsize", 12); |
||||
legendConf.put("legendstyle", 0); |
||||
legendConf.put("showlegend", true); |
||||
} |
||||
return legendConf; |
||||
} |
||||
|
||||
public void setLegendConf(JSONObject legendConf) { |
||||
this.legendConf = legendConf; |
||||
} |
||||
|
||||
public JSONObject getLabelConf() { |
||||
if (null == labelConf) { |
||||
labelConf = new JSONObject(); |
||||
labelConf.put("chartType", 1); |
||||
labelConf.put("lineJsPane", ""); |
||||
labelConf.put("linePosition", "top"); |
||||
labelConf.put("lineValueType", 1); |
||||
labelConf.put("linelabelcolor", "#000000"); |
||||
labelConf.put("linelabelfamily", "微软雅黑"); |
||||
labelConf.put("linelabelsize", 12); |
||||
labelConf.put("linelabelstyle", 0); |
||||
labelConf.put("pieDirection", 0); |
||||
labelConf.put("pieJsPane", "return this.data[1]"); |
||||
labelConf.put("piePosition", "insideTop"); |
||||
labelConf.put("pieValueType", 1); |
||||
labelConf.put("pielabelcolor", "#000000"); |
||||
labelConf.put("pielabelfamily", "微软雅黑"); |
||||
labelConf.put("pielabelsize", 12); |
||||
labelConf.put("pielabelstyle", 0); |
||||
labelConf.put("showLineCategory", false); |
||||
labelConf.put("showLineLabel", true); |
||||
labelConf.put("showLineSeries", false); |
||||
labelConf.put("showLineValue", true); |
||||
labelConf.put("showPieCategory", false); |
||||
labelConf.put("showPieLabel", true); |
||||
labelConf.put("showPieSeries", false); |
||||
labelConf.put("showPieValue", true); |
||||
} |
||||
return labelConf; |
||||
} |
||||
|
||||
public void setLabelConf(JSONObject labelConf) { |
||||
this.labelConf = labelConf; |
||||
} |
||||
|
||||
public JSONObject getSeriesConf() { |
||||
if (null == seriesConf) { |
||||
seriesConf = new JSONObject(); |
||||
seriesConf.put("chartType", 2); |
||||
seriesConf.put("lineCornerColor", "#ffff00"); |
||||
seriesConf.put("lineCornerColorType", "系列色"); |
||||
seriesConf.put("lineCornerRadius", 10); |
||||
seriesConf.put("lineCornerShape", "默认"); |
||||
seriesConf.put("lineCornerType", 0); |
||||
seriesConf.put("lineType", "solid"); |
||||
seriesConf.put("lineWidth", 1); |
||||
seriesConf.put("pieFixWidth", 10); |
||||
seriesConf.put("pieSeriesGapWidth", 30); |
||||
seriesConf.put("pieWidthType", 1); |
||||
seriesConf.put("seriesColorCustom", true); |
||||
seriesConf.put("seriesColorList", "#63b2ee|#76da91|#f8cb7f|#f89588|#7cd6cf|#9192ab|#7898e1|#efa666|#eddd86|#9987ce"); |
||||
seriesConf.put("seriesColorName", ""); |
||||
} |
||||
return seriesConf; |
||||
} |
||||
|
||||
public void setSeriesConf(JSONObject seriesConf) { |
||||
this.seriesConf = seriesConf; |
||||
} |
||||
|
||||
public JSONObject getAxisConf() { |
||||
if (null == axisConf) { |
||||
axisConf = new JSONObject(); |
||||
JSONObject axisX = JSONObject.create(); |
||||
axisX.put("axisName", "X轴"); |
||||
axisX.put("isLabelVisiable", true); |
||||
axisX.put("isTitleVisiable", true); |
||||
axisX.put("labelFormatType", 1); |
||||
axisX.put("labelJsPane", ""); |
||||
axisX.put("labelRotation", 0); |
||||
axisX.put("labelcolor", "#000000"); |
||||
axisX.put("labelfamily", "微软雅黑"); |
||||
axisX.put("labelsize", 12); |
||||
axisX.put("labelstyle", 0); |
||||
axisX.put("titleAlignment", 4); |
||||
axisX.put("titleName", "分类"); |
||||
axisX.put("titleRotation", 0); |
||||
axisX.put("titlecolor", "#000000"); |
||||
axisX.put("titlefamily", "微软雅黑"); |
||||
axisX.put("titlesize", 12); |
||||
axisX.put("titlestyle", 0); |
||||
axisX.put("xformatstr", ""); |
||||
axisX.put("xformattype", 7); |
||||
axisConf.put("axisX", axisX); |
||||
|
||||
JSONArray axisYList = JSONArray.create(); |
||||
JSONObject axisY = JSONObject.create(); |
||||
axisY.put("axisName", "Y轴"); |
||||
axisY.put("intervalValue", ""); |
||||
axisY.put("isLabelVisiable", true); |
||||
axisY.put("isTitleVisiable", true); |
||||
axisY.put("labelFormatType", 1); |
||||
axisY.put("labelJsPane", "return this.value;"); |
||||
axisY.put("labelRotation", 0); |
||||
axisY.put("labelcolor", "#000000"); |
||||
axisY.put("labelfamily", "微软雅黑"); |
||||
axisY.put("labelsize", 12); |
||||
axisY.put("labelstyle", 0); |
||||
axisY.put("maxValue", ""); |
||||
axisY.put("minValue", ""); |
||||
axisY.put("position", "left"); |
||||
axisY.put("showInterval", false); |
||||
axisY.put("showMaxValue", false); |
||||
axisY.put("showMinValue", false); |
||||
axisY.put("titleAlignment", 2); |
||||
axisY.put("titleName", "数量"); |
||||
axisY.put("titleRotation", 0); |
||||
axisY.put("titlecolor", "#000000"); |
||||
axisY.put("titlefamily", "微软雅黑"); |
||||
axisY.put("titlesize", 12); |
||||
axisY.put("titlestyle", 0); |
||||
axisY.put("yformatstr", "#0"); |
||||
axisY.put("yformattype", 1); |
||||
axisYList.put(axisY); |
||||
axisConf.put("axisY", axisYList); |
||||
} |
||||
return axisConf; |
||||
} |
||||
|
||||
public void setAxisConf(JSONObject axisConf) { |
||||
this.axisConf = axisConf; |
||||
} |
||||
|
||||
public JSONObject getTipsConf() { |
||||
if (null == tipsConf) { |
||||
tipsConf = JSONObject.create(); |
||||
tipsConf.put("chartType", 1); |
||||
JSONObject pie = JSONObject.create(); |
||||
pie.put("bgColor", "#000000"); |
||||
pie.put("bgOpacity", 35); |
||||
pie.put("jsPane", ""); |
||||
pie.put("showCategory", true); |
||||
pie.put("showSeries", true); |
||||
pie.put("showTip", true); |
||||
pie.put("showValue", true); |
||||
pie.put("tipcolor", "#ffffff"); |
||||
pie.put("tipfamily", "微软雅黑"); |
||||
pie.put("tipsize", 12); |
||||
pie.put("tipstyle", 0); |
||||
pie.put("valueType", 1); |
||||
tipsConf.put("pie", pie); |
||||
|
||||
JSONObject line = JSONObject.create(); |
||||
line.put("bgColor", "#000000"); |
||||
line.put("bgOpacity", 30); |
||||
line.put("jsPane", "0"); |
||||
line.put("showCategory", false); |
||||
line.put("showSeries", true); |
||||
line.put("showTip", true); |
||||
line.put("showValue", true); |
||||
line.put("tipcolor", "#ffff00"); |
||||
line.put("tipfamily", "微软雅黑"); |
||||
line.put("tipsize", 12); |
||||
line.put("tipstyle", 0); |
||||
line.put("valueType", 1); |
||||
tipsConf.put("line", line); |
||||
} |
||||
return tipsConf; |
||||
} |
||||
|
||||
public void setTipsConf(JSONObject tipsConf) { |
||||
this.tipsConf = tipsConf; |
||||
} |
||||
|
||||
public JSONObject getBgConf() { |
||||
if (bgConf == null) { |
||||
bgConf = JSONObject.create(); |
||||
bgConf.put("bgColor", "#ffffff"); |
||||
bgConf.put("bgOpacity", 100); |
||||
bgConf.put("chartType", 1); |
||||
bgConf.put("fixHeight", 0); |
||||
bgConf.put("gridXColor", "#c0c0c0"); |
||||
bgConf.put("gridXColorCustom", false); |
||||
bgConf.put("gridXColorList", "#2474a9|#97d1f7|#ef6c6c|#f9cd76|#6691e9|#7adbc8|#8861c3|#ffaec8|#936c61|#e4d354|#1d9992|#9ccc66"); |
||||
bgConf.put("gridXColorName", "热情"); |
||||
bgConf.put("gridYColor", "#c0c0c0"); |
||||
} |
||||
return bgConf; |
||||
} |
||||
|
||||
public void setBgConf(JSONObject bgConf) { |
||||
this.bgConf = bgConf; |
||||
} |
||||
|
||||
public JSONObject getStyleCond() { |
||||
if (null == styleCond) { |
||||
styleCond = JSONObject.create(); |
||||
} |
||||
return styleCond; |
||||
} |
||||
|
||||
public void setStyleCond(JSONObject styleCond) { |
||||
this.styleCond = styleCond; |
||||
} |
||||
|
||||
public HyperLinkObject getLinkConf() { |
||||
return linkConf; |
||||
} |
||||
|
||||
public void setLinkConf(HyperLinkObject linkConf) { |
||||
this.linkConf = linkConf; |
||||
} |
||||
} |
@ -0,0 +1,10 @@
|
||||
package com.fr.plugin.pielinecomb; |
||||
|
||||
import com.fr.stable.fun.impl.AbstractLocaleFinder; |
||||
|
||||
public class PieLineCombChartLocaleFinder extends AbstractLocaleFinder { |
||||
@Override |
||||
public String find() { |
||||
return "com/fr/plugin/pielinecomb/locale/pielinecomb"; |
||||
} |
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.fr.plugin.pielinecomb; |
||||
|
||||
import com.fr.extended.chart.AbstractChart; |
||||
import com.fr.extended.chart.AbstractExtentChartProvider; |
||||
|
||||
public class PieLineCombChartProvider extends AbstractExtentChartProvider { |
||||
@Override |
||||
protected AbstractChart createChart() { |
||||
return new PieLineCombChart(); |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
package com.fr.plugin.pielinecomb; |
||||
|
||||
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.data.report.AbstractReportDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.type.AbstractChartTypePane; |
||||
import com.fr.extended.chart.AbstractExtendedChartTableDataPane; |
||||
import com.fr.extended.chart.AbstractExtendedChartUIProvider; |
||||
import com.fr.plugin.pielinecomb.data.CombDataPane; |
||||
import com.fr.plugin.pielinecomb.ui.PieLineCombStylePane; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/19 |
||||
*/ |
||||
public class PieLineCombChartUI extends AbstractExtendedChartUIProvider { |
||||
|
||||
@Override |
||||
public ChartDataPane getChartDataPane(AttributeChangeListener attributeChangeListener) { |
||||
return new CombDataPane(attributeChangeListener); |
||||
} |
||||
|
||||
@Override |
||||
protected AbstractExtendedChartTableDataPane getTableDataSourcePane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected AbstractReportDataContentPane getReportDataSourcePane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public String getIconPath() { |
||||
return "com/fr/plugin/pielinecomb/images/icon.png"; |
||||
} |
||||
|
||||
@Override |
||||
public AbstractChartAttrPane[] getAttrPaneArray(AttributeChangeListener attributeChangeListener) { |
||||
return new AbstractChartAttrPane[]{ |
||||
new PieLineCombStylePane(attributeChangeListener) |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public String[] getDemoImagePath() { |
||||
return new String[]{"com/fr/plugin/pielinecomb/images/demo.png"}; |
||||
} |
||||
|
||||
@Override |
||||
public AbstractChartTypePane getPlotTypePane() { |
||||
return new PieLineCombTypePane(); |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fr.plugin.pielinecomb; |
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.extended.chart.ExtendedTypePane; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/17 |
||||
*/ |
||||
public class PieLineCombTypePane extends ExtendedTypePane<PieLineCombChart> { |
||||
@Override |
||||
protected String[] getTypeIconPath() { |
||||
return new String[]{ |
||||
"com/fr/plugin/pielinecomb/images/pie.png", |
||||
"com/fr/plugin/pielinecomb/images/line.png", |
||||
"com/fr/plugin/pielinecomb/images/comb.png" |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] getTypeTipName() { |
||||
return new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typepie"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typeline"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typecomb") |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected int getTypeIndex(PieLineCombChart pieLineCombChart) { |
||||
return pieLineCombChart.getChartType(); |
||||
} |
||||
|
||||
@Override |
||||
protected void setType(PieLineCombChart pieLineCombChart, int i) { |
||||
pieLineCombChart.setChartType(i); |
||||
} |
||||
} |
@ -0,0 +1,181 @@
|
||||
package com.fr.plugin.pielinecomb.comp; |
||||
|
||||
import com.fr.base.DeprecatedChartWebUtils; |
||||
import com.fr.base.GraphHelper; |
||||
import com.fr.base.chart.chartdata.CallbackEvent; |
||||
import com.fr.base.chart.chartdata.ChartData; |
||||
import com.fr.base.chart.result.WebChartType; |
||||
import com.fr.chart.ChartWebPara; |
||||
import com.fr.chart.chartattr.ChartsPlot; |
||||
import com.fr.chart.chartdata.TopDefinition; |
||||
import com.fr.chart.chartglyph.ChartGlyph; |
||||
import com.fr.extended.chart.AbstractChart; |
||||
import com.fr.extended.chart.AbstractDataConfig; |
||||
import com.fr.extended.chart.ToHyperlinkJSONHelper; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.js.NameJavaScriptGroup; |
||||
import com.fr.json.JSON; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.json.JSONFactory; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.chart.ToJSONHelper; |
||||
import com.fr.plugin.chart.vanchart.VanChartGlyph; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.stable.CoreGraphHelper; |
||||
import com.fr.stable.web.Repository; |
||||
|
||||
import java.awt.*; |
||||
import java.awt.geom.Rectangle2D; |
||||
import java.awt.image.BufferedImage; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author |
||||
* @date 2022/11/2 |
||||
*/ |
||||
public abstract class AbstractCustomChart<T extends AbstractDataConfig> extends AbstractChart { |
||||
|
||||
private static transient Map<String, BufferedImage> demoImages = new HashMap(); |
||||
|
||||
public AbstractCustomChart() { |
||||
ChartsPlot plot = new ChartsPlot(); |
||||
plot.setPlotID(this.getChartID()); |
||||
this.setPlot(plot); |
||||
} |
||||
|
||||
protected BufferedImage getDemoImage() { |
||||
if (demoImages.get(this.getChartID()) == null) { |
||||
BufferedImage var1 = IOUtils.readImage(this.demoImagePath()); |
||||
if (var1 == null) { |
||||
var1 = CoreGraphHelper.createBufferedImage(100, 100, 6); |
||||
} |
||||
|
||||
demoImages.put(this.getChartID(), var1); |
||||
} |
||||
|
||||
return (BufferedImage) demoImages.get(this.getChartID()); |
||||
} |
||||
|
||||
protected BufferedImage getChartImage(Calculator cal, int width, int height) { |
||||
|
||||
if (demoImages.get(this.getChartID()) == null) { |
||||
BufferedImage var1 = IOUtils.readImage(this.demoImagePath()); |
||||
if (var1 == null) { |
||||
var1 = CoreGraphHelper.createBufferedImage(100, 100, 6); |
||||
} |
||||
|
||||
demoImages.put(this.getChartID(), var1); |
||||
} |
||||
|
||||
return (BufferedImage) demoImages.get(this.getChartID()); |
||||
} |
||||
|
||||
@Override |
||||
protected void addJSON(AbstractDataConfig abstractDataConfig, JSONObject jsonObject, Repository repository, AbstractChart.JSONPara jsonPara) throws JSONException { |
||||
AbstractCustomChart<T>.JSONPara jsonParaCustom = new AbstractCustomChart<T>.JSONPara(jsonPara.chartWebPara, jsonPara.ecName, jsonPara.sheetIndex); |
||||
this.addJSON((T) abstractDataConfig, jsonObject, repository, jsonParaCustom); |
||||
} |
||||
|
||||
protected abstract void addJSON(T config, JSONObject json, Repository repo, AbstractCustomChart<T>.JSONPara para) throws JSONException; |
||||
|
||||
@Override |
||||
public ChartGlyph createGlyph(ChartData data) { |
||||
VanChartGlyph chartGlyph = new VanChartGlyph() { |
||||
String ecName; |
||||
int sheetIndex; |
||||
|
||||
@Override |
||||
public Map toJSONMap(String[] deps, double width, double height, Repository repo, int sheetIdx, String ecName) { |
||||
this.ecName = ecName; |
||||
this.sheetIndex = sheetIdx; |
||||
return super.toJSONMap(deps, width, height, repo, sheetIndex, ecName); |
||||
} |
||||
|
||||
@Override |
||||
public JSONObject toJSONObject(Repository repo, double width, double height) throws JSONException { |
||||
return AbstractCustomChart.this.toJSON(repo, false, AbstractCustomChart.this.new JSONPara(this.getChartWebPara(), this.ecName, this.sheetIndex)); |
||||
} |
||||
|
||||
@Override |
||||
public void draw(Graphics g, int p) { |
||||
if (this.getBounds() != null) { |
||||
Rectangle2D rect = this.getBounds(); |
||||
double width = rect.getWidth(); |
||||
double height = rect.getHeight(); |
||||
GraphHelper.paintImage(g, (int) width, (int) height, AbstractCustomChart.this.getDemoImage(), 4, -1, -1, -1, -1); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Image toImage(int width, int height, int p, CallbackEvent callback) { |
||||
if (this.getChartWebPara().getChartIDInfo().getType() != WebChartType.DESIGNER_CHART) { |
||||
return AbstractCustomChart.this.getChartImage((Calculator) this.getChartWebPara().getCalculator(), width, height); |
||||
} else { |
||||
BufferedImage bi = CoreGraphHelper.createBufferedImage(width, height, 6); |
||||
Graphics g = bi.getGraphics(); |
||||
GraphHelper.paintImage(g, width, height, AbstractCustomChart.this.getDemoImage(), 4, -1, -1, -1, -1); |
||||
return bi; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void recordWebPreview() { |
||||
AbstractCustomChart.this.recordPreview(); |
||||
} |
||||
}; |
||||
chartGlyph.setWrapperName(this.wrapperName()); |
||||
chartGlyph.setRequiredJS(this.requiredJS()); |
||||
chartGlyph.setRequiredCSS(this.requiredCSS()); |
||||
return chartGlyph; |
||||
} |
||||
|
||||
private JSONObject toJSON(Repository repo, boolean isDes, AbstractCustomChart<T>.JSONPara para) throws JSONException { |
||||
JSONObject paramJson = (JSONObject) JSONFactory.createJSON(JSON.OBJECT); |
||||
this.checkLicense(paramJson); |
||||
ToHyperlinkJSONHelper.addJSON(repo, paramJson, this.getLinkGroup(), this.hyperLinkParas()); |
||||
paramJson.put("refreshTime", this.isRefreshEnabled() ? this.getAutoRefreshTime() * 1000.0D : 0.0D); |
||||
AbstractDataConfig dataConfig = isDes && this.designerDataConfig() != null ? this.designerDataConfig() : this.getDataConfig(); |
||||
ToJSONHelper.addEmptyDataTip(paramJson, para.chartWebPara); |
||||
ToJSONHelper.addStringLocale(repo, paramJson); |
||||
this.addJSON((T) dataConfig, paramJson, repo, para); |
||||
return paramJson; |
||||
} |
||||
|
||||
@Override |
||||
public Object clone() throws CloneNotSupportedException { |
||||
AbstractCustomChart chart = (AbstractCustomChart) super.clone(); |
||||
chart.setAutoRefreshTime(this.getAutoRefreshTime()); |
||||
chart.setRefreshEnabled(this.isRefreshEnabled()); |
||||
if (this.getLinkGroup() != null) { |
||||
chart.setLinkGroup((NameJavaScriptGroup) this.getLinkGroup().clone()); |
||||
} |
||||
|
||||
if (this.getFilterDefinition() != null) { |
||||
chart.setFilterDefinition((TopDefinition) this.getFilterDefinition().clone()); |
||||
} |
||||
|
||||
return chart; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object src) { |
||||
return super.equals(src) && src instanceof AbstractCustomChart && ComparatorUtils.equals(this.getChartID(), ((AbstractCustomChart) src).getChartID()) && ComparatorUtils.equals(this.getLinkGroup(), ((AbstractCustomChart) src).getLinkGroup()) && ComparatorUtils.equals(this.isRefreshEnabled(), ((AbstractCustomChart) src).isRefreshEnabled()) && ComparatorUtils.equals(this.getAutoRefreshTime(), ((AbstractCustomChart) src).getAutoRefreshTime()); |
||||
} |
||||
|
||||
protected class JSONPara { |
||||
public ChartWebPara chartWebPara; |
||||
@Deprecated |
||||
public String webChartID; |
||||
public String ecName; |
||||
public int sheetIndex; |
||||
|
||||
JSONPara(ChartWebPara webPara, String ecName, int sheetIndex) { |
||||
this.chartWebPara = webPara; |
||||
this.webChartID = DeprecatedChartWebUtils.createPainterID(webPara.getChartIDInfo()); |
||||
this.ecName = ecName; |
||||
this.sheetIndex = sheetIndex; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,282 @@
|
||||
package com.fr.plugin.pielinecomb.comp; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.chart.VanChartAttrHelper; |
||||
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
||||
import com.fr.plugin.chart.attr.plot.VanChartAxisPlot; |
||||
import com.fr.plugin.pielinecomb.ui.PieLineCombStyleAxisPane; |
||||
import com.fr.van.chart.designer.style.axis.VanChartAxisPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.*; |
||||
import java.awt.geom.Rectangle2D; |
||||
import java.awt.image.BufferedImage; |
||||
import java.awt.image.ImageObserver; |
||||
import java.util.ArrayList; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/20 |
||||
*/ |
||||
public class CustomChartAxisButtonPane extends BasicBeanPane<JSONObject> { |
||||
private static final int B_W = 56; |
||||
private static final int B_H = 21; |
||||
private static final int COL_COUNT = 3; |
||||
private static final int MAX_COUNT = 20; |
||||
private UIButton addButton; |
||||
|
||||
private List<CustomChartAxisButtonPane.ChartAxisButton> indexList_Y = new ArrayList(); |
||||
private JPanel buttonPane; |
||||
private PieLineCombStyleAxisPane parent; |
||||
|
||||
|
||||
public CustomChartAxisButtonPane(PieLineCombStyleAxisPane var1) { |
||||
this.parent = var1; |
||||
this.setLayout(new BorderLayout()); |
||||
this.addButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); |
||||
JPanel var2 = new JPanel(new BorderLayout()); |
||||
var2.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 20)); |
||||
var2.add(this.addButton, "North"); |
||||
//this.addButton.setVisible(false);
|
||||
this.add(var2, "East"); |
||||
this.buttonPane = new JPanel(); |
||||
this.buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 0)); |
||||
this.add(this.buttonPane, "Center"); |
||||
|
||||
this.addButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent var1) { |
||||
//添加Y轴
|
||||
CustomChartAxisButtonPane.this.addYAxis(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void layoutPane() { |
||||
if (this.buttonPane != null) { |
||||
this.buttonPane.removeAll(); |
||||
this.buttonPane.setLayout(new BoxLayout(this.buttonPane, 1)); |
||||
JPanel var1 = null; |
||||
int var3 = this.indexList_Y.size(); |
||||
|
||||
|
||||
for(int i = 0; i < this.indexList_Y.size(); i++) { |
||||
if (i % 3 == 0) { |
||||
var1 = new JPanel(new FlowLayout(0, 0, 0)); |
||||
this.buttonPane.add(var1); |
||||
} |
||||
|
||||
if (var1 != null) { |
||||
var1.add((Component)this.indexList_Y.get(i)); |
||||
} |
||||
} |
||||
|
||||
this.revalidate(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Switch_Chart"); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(JSONObject var1) { |
||||
|
||||
this.indexList_Y.clear(); |
||||
|
||||
JSONObject axisX = var1.getJSONObject("axisX"); |
||||
CustomChartAxisButtonPane.ChartAxisButton axisXButton = new CustomChartAxisButtonPane.ChartAxisButton(axisX.getString("axisName")); |
||||
axisXButton.setToolTipText(axisX.getString("axisName")); |
||||
this.indexList_Y.add(axisXButton); |
||||
|
||||
JSONArray var7 = var1.getJSONArray("axisY"); |
||||
Iterator var8 = var7.iterator(); |
||||
|
||||
while(var8.hasNext()) { |
||||
JSONObject var9 = (JSONObject)var8.next(); |
||||
CustomChartAxisButtonPane.ChartAxisButton var6 = new CustomChartAxisButtonPane.ChartAxisButton(var9.getString("axisName")); |
||||
var6.setToolTipText(var9.getString("axisName")); |
||||
this.indexList_Y.add(var6); |
||||
} |
||||
|
||||
this.layoutPane(); |
||||
} |
||||
|
||||
@Override |
||||
public JSONObject updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
public String getNewChartName(List<CustomChartAxisButtonPane.ChartAxisButton> var1, String var2) { |
||||
int var3 = var1.size(); |
||||
|
||||
while(true) { |
||||
String var4 = var2 + var3; |
||||
boolean var5 = false; |
||||
Iterator var6 = var1.iterator(); |
||||
|
||||
while(var6.hasNext()) { |
||||
CustomChartAxisButtonPane.ChartAxisButton var7 = (CustomChartAxisButtonPane.ChartAxisButton)var6.next(); |
||||
if (ComparatorUtils.equals(var7.getButtonName(), var4)) { |
||||
var5 = true; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
if (!var5) { |
||||
return var4; |
||||
} |
||||
|
||||
++var3; |
||||
} |
||||
} |
||||
|
||||
private void addYAxis() { |
||||
String var1 = this.getNewChartName(this.indexList_Y, VanChartAttrHelper.Y_AXIS_PREFIX); |
||||
CustomChartAxisButtonPane.ChartAxisButton var2 = new CustomChartAxisButtonPane.ChartAxisButton(var1); |
||||
this.indexList_Y.add(var2); |
||||
this.parent.addAxisPane(var1); |
||||
this.layoutPane(); |
||||
} |
||||
|
||||
private void changeAxisSelected(String var1) { |
||||
this.parent.changeAxisSelected(var1); |
||||
} |
||||
|
||||
private class ChartAxisButton extends UIToggleButton { |
||||
private static final double DEL_WIDTH = 10.0D; |
||||
private static final long serialVersionUID = -3701452534814584608L; |
||||
private BufferedImage closeIcon = BaseUtils.readImageWithCache("com/fr/design/images/toolbarbtn/chartChangeClose.png"); |
||||
private boolean isMoveOn = false; |
||||
private String buttonName = ""; |
||||
|
||||
public ChartAxisButton(String var2) { |
||||
super(var2); |
||||
this.buttonName = var2; |
||||
} |
||||
|
||||
public String getButtonName() { |
||||
return this.buttonName; |
||||
} |
||||
|
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
return new Dimension(56, 21); |
||||
} |
||||
|
||||
private void paintDeleteButton(Graphics var1) { |
||||
Rectangle var2 = this.getBounds(); |
||||
int var3 = (int)(var2.getWidth() - 10.0D); |
||||
byte var4 = 1; |
||||
var1.drawImage(this.closeIcon, var3, var4, this.closeIcon.getWidth(), this.closeIcon.getHeight(), (ImageObserver)null); |
||||
} |
||||
|
||||
@Override |
||||
public void paintComponent(Graphics var1) { |
||||
super.paintComponent(var1); |
||||
if (this.isMoveOn && this.getButtonList().size() > 1 && !VanChartAttrHelper.isDefaultAxis(this.buttonName)) { |
||||
this.paintDeleteButton(var1); |
||||
} |
||||
|
||||
} |
||||
|
||||
private List<CustomChartAxisButtonPane.ChartAxisButton> getButtonList() { |
||||
return CustomChartAxisButtonPane.this.indexList_Y; |
||||
} |
||||
|
||||
private void noSelected() { |
||||
|
||||
CustomChartAxisButtonPane.ChartAxisButton var2; |
||||
Iterator var1 = CustomChartAxisButtonPane.this.indexList_Y.iterator(); |
||||
|
||||
while(var1.hasNext()) { |
||||
var2 = (CustomChartAxisButtonPane.ChartAxisButton)var1.next(); |
||||
var2.setSelected(false); |
||||
} |
||||
|
||||
} |
||||
|
||||
private void checkMoveOn(boolean var1) { |
||||
Iterator var2; |
||||
CustomChartAxisButtonPane.ChartAxisButton var3; |
||||
|
||||
for(var2 = CustomChartAxisButtonPane.this.indexList_Y.iterator(); var2.hasNext(); var3.isMoveOn = false) { |
||||
var3 = (CustomChartAxisButtonPane.ChartAxisButton)var2.next(); |
||||
} |
||||
|
||||
this.isMoveOn = var1; |
||||
} |
||||
|
||||
private Rectangle2D getRectBounds() { |
||||
return this.getBounds(); |
||||
} |
||||
|
||||
private void deleteAButton() { |
||||
List var1 = this.getButtonList(); |
||||
if (var1.contains(this) && var1.size() > 1) { |
||||
var1.remove(this); |
||||
CustomChartAxisButtonPane.this.parent.delAxisPane(this.buttonName); |
||||
//CustomChartAxisButtonPane.this.parent.removeAxis(this.buttonName);
|
||||
if (this.isSelected()) { |
||||
((CustomChartAxisButtonPane.ChartAxisButton)var1.get(0)).setSelected(true); |
||||
CustomChartAxisButtonPane.this.changeAxisSelected(((CustomChartAxisButtonPane.ChartAxisButton)var1.get(0)).getButtonName()); |
||||
|
||||
} |
||||
} |
||||
|
||||
this.reLayoutPane(); |
||||
} |
||||
|
||||
private void reLayoutPane() { |
||||
CustomChartAxisButtonPane.this.layoutPane(); |
||||
} |
||||
|
||||
@Override |
||||
protected MouseListener getMouseListener() { |
||||
return new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent var1) { |
||||
CustomChartAxisButtonPane.ChartAxisButton.this.mouseClick(var1); |
||||
} |
||||
@Override |
||||
public void mouseEntered(MouseEvent var1) { |
||||
CustomChartAxisButtonPane.ChartAxisButton.this.checkMoveOn(true); |
||||
} |
||||
@Override |
||||
public void mouseExited(MouseEvent var1) { |
||||
CustomChartAxisButtonPane.ChartAxisButton.this.checkMoveOn(false); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
public void mouseClick(MouseEvent var1) { |
||||
Rectangle2D var2 = this.getRectBounds(); |
||||
if (var2 != null) { |
||||
if ((double)var1.getX() >= var2.getWidth() - 10.0D && !VanChartAttrHelper.isDefaultAxis(this.buttonName)) { |
||||
this.deleteAButton(); |
||||
this.fireSelectedChanged(); |
||||
} else { |
||||
if (this.isEnabled()) { |
||||
this.noSelected(); |
||||
CustomChartAxisButtonPane.this.changeAxisSelected(this.getButtonName()); |
||||
this.setSelectedWithFireListener(true); |
||||
this.fireSelectedChanged(); |
||||
} |
||||
|
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,75 @@
|
||||
package com.fr.plugin.pielinecomb.comp; |
||||
|
||||
import com.fr.chart.base.AttrFillStyle; |
||||
import com.fr.design.gui.icombobox.ColorSchemeComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.DesignerBean; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.predefined.ui.detail.ColorFillStylePane; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/11 |
||||
*/ |
||||
public class CustomChartFillStylePane extends ColorFillStylePane implements DesignerBean { |
||||
public static final String name = "customChartFillStyle"; |
||||
|
||||
public CustomChartFillStylePane() { |
||||
DesignerContext.setDesignerBean("customChartFillStyle", this); |
||||
} |
||||
|
||||
@Override |
||||
protected void styleSelectBoxChange() { |
||||
super.styleSelectBoxChange(); |
||||
} |
||||
|
||||
@Override |
||||
protected ColorSchemeComboBox createColorSchemeComboBox() { |
||||
return new CustomColorSchemeComboBox(); |
||||
} |
||||
|
||||
@Override |
||||
protected void initLayout() { |
||||
super.initLayout(); |
||||
this.add(this.getContentPane(), "Center"); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel getContentPane() { |
||||
JPanel var1 = super.getContentPane(); |
||||
var1.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); |
||||
return var1; |
||||
} |
||||
|
||||
@Override |
||||
protected Component[][] contentPaneComponents() { |
||||
return new Component[][]{{null, null}, {new UILabel(Toolkit.i18nText("Fine-Design_Chart_Match_Color_Scheme")), this.getStyleSelectBox()}, {null, this.getCustomPane()}}; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Fine-Design_Chart_Color"); |
||||
} |
||||
|
||||
public void populateBean(AttrFillStyle var1) { |
||||
this.populateBean(var1.getColorFillStyle()); |
||||
} |
||||
|
||||
public void updateBean(AttrFillStyle var1) { |
||||
var1.setColorFillStyle(this.updateBean()); |
||||
} |
||||
|
||||
@Override |
||||
public void refreshBeanElement() { |
||||
AttrFillStyle var1 = new AttrFillStyle(); |
||||
this.updateBean(var1); |
||||
this.getStyleSelectBox().refresh(); |
||||
this.populateBean(var1); |
||||
GUICoreUtils.repaint(this); |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.plugin.pielinecomb.comp; |
||||
|
||||
|
||||
import com.fr.design.gui.icombobox.ColorSchemeComboBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/11 |
||||
*/ |
||||
public class CustomColorSchemeComboBox extends ColorSchemeComboBox { |
||||
|
||||
@Override |
||||
protected Map<String, ColorInfo> getColorSchemesFromConfig() { |
||||
Map<String, ColorInfo> schemesConfig = super.getColorSchemesFromConfig(); |
||||
schemesConfig.remove(Toolkit.i18nText("Fine-Design_Chart_Custom_Gradient")); |
||||
return schemesConfig; |
||||
} |
||||
|
||||
@Override |
||||
public SelectType getSelectType() { |
||||
int var1 = this.getSelectedIndex(); |
||||
int var2 = this.getItemCount(); |
||||
if (var1 == var2 - 1) { |
||||
return SelectType.COMBINATION_COLOR; |
||||
} else { |
||||
return SelectType.NORMAL; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void setSelectType(SelectType var1) { |
||||
int var2 = this.getItemCount(); |
||||
switch(var1) { |
||||
case DEFAULT: |
||||
this.setSelectedIndex(0); |
||||
break; |
||||
case COMBINATION_COLOR: |
||||
this.setSelectedIndex(var2 - 1); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,355 @@
|
||||
package com.fr.plugin.pielinecomb.comp; |
||||
|
||||
import com.fr.base.GraphHelper; |
||||
import com.fr.data.core.FormatField; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.border.UIRoundedBorder; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.event.GlobalNameListener; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.icombobox.TextFontComboBox; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.style.FRFontPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.Border; |
||||
import javax.swing.border.TitledBorder; |
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
import java.text.Format; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/21 |
||||
*/ |
||||
public class CustomFormatPane extends BasicBeanPane<TextFormat> { |
||||
private static final int LABEL_X = 4; |
||||
private static final int LABEL_Y = 18; |
||||
private static final int LABEL_DELTA_WIDTH = 8; |
||||
private static final int LABEL_HEIGHT = 15; |
||||
private static final int CURRENCY_FLAG_POINT = 6; |
||||
private static final Border LEFT_BORDER = BorderFactory.createEmptyBorder(0, 30, 0, 0); |
||||
private static final Integer[] TYPES = new Integer[]{0, 1, 2, 3, 4, 5, 6, 7}; |
||||
private static final Integer[] DATE_TYPES = new Integer[]{0, 5, 6}; |
||||
private Format format; |
||||
private UIComboBox typeComboBox; |
||||
private TextFontComboBox textField; |
||||
private UILabel sampleLabel; |
||||
private JPanel contentPane; |
||||
private JPanel txtCenterPane; |
||||
private JPanel centerPane; |
||||
private JPanel optionPane; |
||||
private UICheckBox roundingBox; |
||||
private JPanel formatFontPane; |
||||
private FRFontPane frFontPane; |
||||
private boolean isRightFormat; |
||||
private boolean isDate = false; |
||||
private GlobalNameListener globalNameListener = null; |
||||
ItemListener itemListener = new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent var1) { |
||||
if (var1.getStateChange() == 1) { |
||||
int var2 = CustomFormatPane.this.getFormatContents(); |
||||
String[] var3 = FormatField.getInstance().getFormatArray(var2, false); |
||||
CardLayout var4 = (CardLayout)CustomFormatPane.this.centerPane.getLayout(); |
||||
if (CustomFormatPane.this.isTextOrNull()) { |
||||
CustomFormatPane.this.centerPane.setPreferredSize(new Dimension(0, 0)); |
||||
var4.show(CustomFormatPane.this.centerPane, "hide"); |
||||
} else { |
||||
CustomFormatPane.this.textField.removeAllItems(); |
||||
CustomFormatPane.this.textField.setItemArray(var3); |
||||
CustomFormatPane.this.textField.setSelectedIndex(0); |
||||
CustomFormatPane.this.centerPane.setPreferredSize(new Dimension(270, 65)); |
||||
var4.show(CustomFormatPane.this.centerPane, "show"); |
||||
} |
||||
|
||||
CardLayout var5 = (CardLayout)CustomFormatPane.this.optionPane.getLayout(); |
||||
if (CustomFormatPane.this.getFormatContents() == 3) { |
||||
CustomFormatPane.this.optionPane.setPreferredSize(new Dimension(100, 20)); |
||||
var5.show(CustomFormatPane.this.optionPane, "show"); |
||||
} else { |
||||
CustomFormatPane.this.optionPane.setPreferredSize(new Dimension(0, 0)); |
||||
var5.show(CustomFormatPane.this.optionPane, "hide"); |
||||
CustomFormatPane.this.roundingBox.setSelected(false); |
||||
} |
||||
} |
||||
|
||||
} |
||||
}; |
||||
ItemListener textFieldItemListener = new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent var1) { |
||||
if (var1.getStateChange() == 1) { |
||||
CustomFormatPane.this.refreshPreviewLabel(); |
||||
} |
||||
|
||||
} |
||||
}; |
||||
|
||||
public CustomFormatPane() { |
||||
this.initComponents(TYPES); |
||||
} |
||||
|
||||
protected void initComponents(Integer[] var1) { |
||||
this.setLayout(new BorderLayout(0, 4)); |
||||
this.initSampleLabel(); |
||||
this.contentPane = new JPanel(new BorderLayout(0, 4)) { |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
return new Dimension(super.getPreferredSize().width, 65); |
||||
} |
||||
}; |
||||
this.typeComboBox = new UIComboBox(var1); |
||||
UIComboBoxRenderer var2 = this.createComBoxRender(); |
||||
this.typeComboBox.setRenderer(var2); |
||||
this.typeComboBox.addItemListener(this.itemListener); |
||||
this.typeComboBox.setGlobalName("typeComboBox"); |
||||
this.contentPane.add(this.sampleLabel, "North"); |
||||
this.txtCenterPane = new JPanel(new BorderLayout()); |
||||
this.textField = new TextFontComboBox(); |
||||
this.textField.addItemListener(this.textFieldItemListener); |
||||
this.textField.setEditable(true); |
||||
this.textField.setGlobalName("textField"); |
||||
this.txtCenterPane.add(this.textField, "North"); |
||||
this.contentPane.add(this.txtCenterPane, "Center"); |
||||
this.centerPane = new JPanel(new CardLayout()); |
||||
this.centerPane.add(new JPanel(), "hide"); |
||||
this.centerPane.setPreferredSize(new Dimension(0, 0)); |
||||
this.centerPane.add(this.contentPane, "show"); |
||||
this.frFontPane = new FRFontPane(); |
||||
UILabel var3 = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FR_Font"), 2); |
||||
JPanel var4 = new JPanel(new BorderLayout()); |
||||
var4.add(var3, "North"); |
||||
this.typeComboBox.setPreferredSize(new Dimension(155, 20)); |
||||
JPanel var5 = new JPanel(new BorderLayout()); |
||||
var5.add(this.typeComboBox, "Center"); |
||||
var5.setBorder(LEFT_BORDER); |
||||
this.frFontPane.setBorder(LEFT_BORDER); |
||||
JPanel var6 = new JPanel(new BorderLayout()); |
||||
var6.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Option"), 2), "West"); |
||||
this.roundingBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Option_Half_Up")); |
||||
this.roundingBox.setBorder(BorderFactory.createEmptyBorder(0, 40, 0, 0)); |
||||
this.roundingBox.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent var1) { |
||||
} |
||||
}); |
||||
this.roundingBox.setGlobalName("roundingBox"); |
||||
var6.add(this.roundingBox, "Center"); |
||||
this.optionPane = new JPanel(new CardLayout()); |
||||
this.optionPane.add(new JPanel(), "hide"); |
||||
this.optionPane.setPreferredSize(new Dimension(0, 0)); |
||||
this.optionPane.add(var6, "show"); |
||||
Component[][] var7 = this.getComponent(var4, this.centerPane, var5); |
||||
this.add(this.createContentPane(var7), "Center"); |
||||
} |
||||
|
||||
protected JPanel createContentPane(Component[][] var1) { |
||||
double var2 = -1.0D; |
||||
double var4 = -2.0D; |
||||
double[] var6 = new double[]{var4, var4, var4, var4, var4}; |
||||
double[] var7 = new double[]{var4, var2}; |
||||
int[][] var8 = new int[][]{{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}; |
||||
return TableLayoutHelper.createGapTableLayoutPane(var1, var6, var7, var8, 10.0D, 6.0D); |
||||
} |
||||
|
||||
protected Component[][] getComponent(JPanel var1, JPanel var2, JPanel var3) { |
||||
return new Component[][]{{null, null}, {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_Format"), 2), var3}, {var2, null}, {this.optionPane, null}, {var1, this.frFontPane}}; |
||||
} |
||||
|
||||
protected UIComboBoxRenderer createComBoxRender() { |
||||
return new UIComboBoxRenderer() { |
||||
@Override |
||||
public Component getListCellRendererComponent(JList var1, Object var2, int var3, boolean var4, boolean var5) { |
||||
JLabel var6 = (JLabel)super.getListCellRendererComponent(var1, var2, var3, var4, var5); |
||||
if (var2 instanceof Integer) { |
||||
var6.setText(" " + FormatField.getInstance().getName((Integer)var2)); |
||||
} |
||||
|
||||
return var6; |
||||
} |
||||
}; |
||||
} |
||||
|
||||
private void initSampleLabel() { |
||||
UIRoundedBorder var1 = new UIRoundedBorder(UIConstants.LINE_COLOR, 1, 4); |
||||
String var2 = Toolkit.i18nText("Fine-Design_Report_Base_StyleFormat_Sample"); |
||||
TitledBorder var3 = BorderFactory.createTitledBorder(var1, var2, 1, 0, (Font)null, UIConstants.LINE_COLOR); |
||||
this.sampleLabel = new UILabel(FormatField.getInstance().getFormatValue()) { |
||||
@Override |
||||
public void paint(Graphics var1) { |
||||
super.paint(var1); |
||||
int var2 = this.getWidth(); |
||||
Color var3 = var1.getColor(); |
||||
var1.setColor(this.getBackground()); |
||||
var1.fillRect(4, 18, var2 - 8, 15); |
||||
var1.setColor(UIConstants.LINE_COLOR); |
||||
FontMetrics var4 = var1.getFontMetrics(); |
||||
int var5 = var4.stringWidth(this.getText()); |
||||
GraphHelper.drawString(var1, this.getText(), (double)((var2 - var5) / 2), 26.0D); |
||||
var1.setColor(var3); |
||||
} |
||||
}; |
||||
this.sampleLabel.setHorizontalAlignment(0); |
||||
this.sampleLabel.setBorder(var3); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
return this.typeComboBox.getSelectedIndex() == 0 ? this.typeComboBox.getPreferredSize() : super.getPreferredSize(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(TextFormat textFormat) { |
||||
this.typeComboBox.setSelectedItem(textFormat.getType()); |
||||
this.textField.setSelectedItem(textFormat.getFormatStr()); |
||||
} |
||||
|
||||
@Override |
||||
public TextFormat updateBean() { |
||||
TextFormat textFormat = new TextFormat(); |
||||
textFormat.setFormatStr(String.valueOf(this.textField.getSelectedItem())); |
||||
textFormat.setType((Integer)this.typeComboBox.getSelectedItem()); |
||||
return textFormat; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
private boolean isCurrencyFormatStyle(String var1) { |
||||
if (var1.length() == 0) { |
||||
return false; |
||||
} else if (var1.charAt(0) != 164 && var1.charAt(0) != '$') { |
||||
return var1.length() > 6 && var1.startsWith("#,##0;"); |
||||
} else { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
public static int isArrayContainPattern(String[] var0, String var1) { |
||||
for(int var2 = 0; var2 < var0.length; ++var2) { |
||||
if (ComparatorUtils.equals(var0[var2], var1)) { |
||||
return var2; |
||||
} |
||||
} |
||||
|
||||
return -1; |
||||
} |
||||
|
||||
private void setPatternComboBoxAndList(int var1, String var2) { |
||||
this.typeComboBox.setSelectedItem(var1); |
||||
this.textField.setSelectedItem(var2); |
||||
} |
||||
|
||||
private boolean isTimeType(String var1) { |
||||
return var1.matches(".*[Hhmsa].*"); |
||||
} |
||||
|
||||
private int getFormatContents() { |
||||
return (Integer)this.typeComboBox.getSelectedItem(); |
||||
} |
||||
|
||||
private void refreshPreviewLabel() { |
||||
this.sampleLabel.setText(FormatField.getInstance().getFormatValue()); |
||||
this.sampleLabel.setForeground(UIManager.getColor("Label.foreground")); |
||||
|
||||
try { |
||||
this.isRightFormat = true; |
||||
if (StringUtils.isEmpty(String.valueOf(this.textField.getSelectedItem()))) { |
||||
return; |
||||
} |
||||
|
||||
this.sampleLabel.setText(FormatField.getInstance().getFormatValue(this.getFormatContents(), String.valueOf(this.textField.getSelectedItem()))); |
||||
} catch (Exception var2) { |
||||
this.sampleLabel.setForeground(Color.red); |
||||
this.sampleLabel.setText(var2.getMessage()); |
||||
this.isRightFormat = false; |
||||
} |
||||
|
||||
} |
||||
|
||||
private boolean isTextOrNull() { |
||||
int var1 = this.getFormatContents(); |
||||
return var1 == 7 || var1 == 0; |
||||
} |
||||
|
||||
public void justUsePercentFormat() { |
||||
this.typeComboBox.setEnabled(false); |
||||
this.typeComboBox.setSelectedItem(3); |
||||
} |
||||
|
||||
public void setForDataSheet() { |
||||
Integer[] var1 = new Integer[]{0, 1, 2, 3, 4}; |
||||
this.typeComboBox = new UIComboBox(var1); |
||||
UIComboBoxRenderer var2 = new UIComboBoxRenderer() { |
||||
@Override |
||||
public Component getListCellRendererComponent(JList var1, Object var2, int var3, boolean var4, boolean var5) { |
||||
JLabel var6 = (JLabel)super.getListCellRendererComponent(var1, var2, var3, var4, var5); |
||||
if (var2 instanceof Integer) { |
||||
var6.setText(" " + FormatField.getInstance().getName((Integer)var2)); |
||||
} |
||||
|
||||
return var6; |
||||
} |
||||
}; |
||||
this.typeComboBox.setRenderer(var2); |
||||
this.typeComboBox.addItemListener(this.itemListener); |
||||
this.setTypeComboBoxPane(this.typeComboBox); |
||||
} |
||||
|
||||
protected void setTypeComboBoxPane(UIComboBox var1) { |
||||
this.add(var1, "North"); |
||||
} |
||||
|
||||
public void setComboBoxModel(boolean var1) { |
||||
if (this.isDate != var1) { |
||||
this.isDate = var1; |
||||
this.typeComboBox.setSelectedIndex(0); |
||||
int var2; |
||||
if (var1) { |
||||
for(var2 = 0; var2 < DATE_TYPES.length; ++var2) { |
||||
this.typeComboBox.addItem(DATE_TYPES[var2]); |
||||
} |
||||
|
||||
for(var2 = 0; var2 < TYPES.length; ++var2) { |
||||
this.typeComboBox.removeItemAt(1); |
||||
} |
||||
} else { |
||||
for(var2 = 0; var2 < TYPES.length; ++var2) { |
||||
this.typeComboBox.addItem(TYPES[var2]); |
||||
} |
||||
|
||||
for(var2 = 0; var2 < DATE_TYPES.length; ++var2) { |
||||
this.typeComboBox.removeItemAt(1); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
public void registerNameListener(GlobalNameListener var1) { |
||||
this.globalNameListener = var1; |
||||
} |
||||
|
||||
public void registerChangeListener(UIObserverListener var1) { |
||||
this.typeComboBox.registerChangeListener(var1); |
||||
this.textField.registerChangeListener(var1); |
||||
} |
||||
|
||||
public boolean shouldResponseNameListener() { |
||||
return false; |
||||
} |
||||
|
||||
public void setGlobalName(String var1) { |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.plugin.pielinecomb.comp; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/21 |
||||
*/ |
||||
public class TextFormat { |
||||
private Integer type; |
||||
private String formatStr; |
||||
|
||||
public Integer getType() { |
||||
return type; |
||||
} |
||||
|
||||
public void setType(Integer type) { |
||||
this.type = type; |
||||
} |
||||
|
||||
public String getFormatStr() { |
||||
return formatStr; |
||||
} |
||||
|
||||
public void setFormatStr(String formatStr) { |
||||
this.formatStr = formatStr; |
||||
} |
||||
} |
@ -0,0 +1,147 @@
|
||||
package com.fr.plugin.pielinecomb.comp; |
||||
|
||||
import com.fr.general.IOUtils; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.os.OperatingSystem; |
||||
import com.fr.third.org.apache.commons.io.FileUtils; |
||||
|
||||
import java.io.BufferedReader; |
||||
import java.io.ByteArrayInputStream; |
||||
import java.io.File; |
||||
import java.io.InputStreamReader; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/9/28 |
||||
*/ |
||||
public class WebPageRender { |
||||
private static String CHART_PATH = ""; |
||||
private static WebPageRender webPage = new WebPageRender(); |
||||
|
||||
private WebPageRender() { |
||||
} |
||||
public static WebPageRender getInstance() { |
||||
return webPage; |
||||
} |
||||
|
||||
public String makeChartImage(JSONObject options, int width, int height) { |
||||
Process process = null; |
||||
try { |
||||
prepareChartDir(options); |
||||
|
||||
String cmd = ""; |
||||
if (OperatingSystem.isWindows()) { |
||||
cmd += "cmd /c cd " + CHART_PATH + " && phantomjs "; |
||||
} else { |
||||
cmd += "cd " + CHART_PATH + " && phantomjs "; |
||||
} |
||||
cmd += "export.js -chartname PieLineCombChartWrapper -width " + width + " -height " + height; |
||||
|
||||
process = Runtime.getRuntime().exec(cmd); |
||||
/** |
||||
* 获取控制台输出信息 |
||||
* 通过JS中使用console.log()打印输出base64编码 |
||||
* 获取进程输入流,进行base64编码获取 |
||||
*/ |
||||
BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream())); |
||||
|
||||
String line = ""; |
||||
StringBuffer base64Img = new StringBuffer(); |
||||
while ((line = input.readLine()) != null) { |
||||
base64Img.append(line); |
||||
} |
||||
|
||||
String imgStr = base64Img.toString(); |
||||
if (imgStr.indexOf(",") > 0) { |
||||
imgStr = imgStr.substring(imgStr.indexOf(",") + 1); |
||||
} |
||||
|
||||
return imgStr; |
||||
|
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} finally { |
||||
if (null != process) { |
||||
process.destroy(); |
||||
} |
||||
} |
||||
return ""; |
||||
} |
||||
|
||||
private void prepareChartDir(JSONObject options) { |
||||
try { |
||||
options.put("isLoadAnimal", false); |
||||
String optionStr = options.toString(); |
||||
optionStr = "window.chartOptions = " + optionStr; |
||||
|
||||
if (StringUtils.isEmpty(CHART_PATH)) { |
||||
String path = this.getClass().getProtectionDomain().getCodeSource().getLocation().getFile(); |
||||
path = java.net.URLDecoder.decode(path, "UTF-8"); |
||||
System.out.println("path: " + path); |
||||
File pluginDir = new File(path); |
||||
CHART_PATH = pluginDir.getParent() + File.separator + "chartexport"; |
||||
} |
||||
|
||||
File chartPath = new File(CHART_PATH); |
||||
chartPath.mkdirs(); |
||||
|
||||
File delFile = new File(CHART_PATH + File.separator + "chartdata.js"); |
||||
if (delFile.exists()) { |
||||
delFile.delete(); |
||||
} |
||||
|
||||
/*if (OperatingSystem.isWindows()) { |
||||
if (!new File(CHART_PATH + File.separator + "phantomjs.exe").exists()) { |
||||
IOUtils.copy(this.getClass().getResourceAsStream("/com/fr/plugin/boxplot/web/phantomjs.exe"), "phantomjs.exe", chartPath); |
||||
} |
||||
} else if (OperatingSystem.isMacos()) { |
||||
if (!new File(CHART_PATH + File.separator + "phantomjs").exists()) { |
||||
IOUtils.copy(this.getClass().getResourceAsStream("/com/fr/plugin/boxplot/web/phantomjs-mac"), "phantomjs", chartPath); |
||||
} |
||||
} else { |
||||
if (!new File(CHART_PATH + File.separator + "phantomjs").exists()) { |
||||
IOUtils.copy(this.getClass().getResourceAsStream("/com/fr/plugin/boxplot/web/phantomjs-linux"), "phantomjs", chartPath); |
||||
} |
||||
}*/ |
||||
|
||||
if (!new File(CHART_PATH + File.separator + "fr.js").exists()) { |
||||
IOUtils.copy(this.getClass().getResourceAsStream("/com/fr/plugin/pielinecomb/web/fr.js"), "fr.js", chartPath); |
||||
} |
||||
if (!new File(CHART_PATH + File.separator + "jquery.js").exists()) { |
||||
IOUtils.copy(this.getClass().getResourceAsStream("/com/fr/plugin/pielinecomb/web/jquery.js"), "jquery.js", chartPath); |
||||
} |
||||
if (!new File(CHART_PATH + File.separator + "echarts.js").exists()) { |
||||
IOUtils.copy(this.getClass().getResourceAsStream("/com/fr/plugin/pielinecomb/web/echarts.min.js"), "echarts.js", chartPath); |
||||
} |
||||
IOUtils.copy(this.getClass().getResourceAsStream("/com/fr/plugin/pielinecomb/web/export.js"), "export.js", chartPath); |
||||
IOUtils.copy(this.getClass().getResourceAsStream("/com/fr/plugin/pielinecomb/web/PieLineCombChartWrapper.js"), "chartwrapper.js", chartPath); |
||||
IOUtils.copy(new ByteArrayInputStream(optionStr.getBytes("UTF-8")), "chartdata.js", chartPath); |
||||
|
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
|
||||
public boolean isDataChanged(JSONObject options) { |
||||
try { |
||||
if (StringUtils.isEmpty(CHART_PATH)) { |
||||
return true; |
||||
} |
||||
String optionStr = options.toString(); |
||||
optionStr = "window.chartOptions = " + optionStr; |
||||
|
||||
File dataFile = new File(CHART_PATH + File.separator + "chartdata.js"); |
||||
if (dataFile.exists()) { |
||||
String oldData = FileUtils.readFileToString(dataFile, "UTF-8"); |
||||
if (StringUtils.isNotEmpty(oldData) && oldData.equals(optionStr)) { |
||||
return false; |
||||
} |
||||
} |
||||
} catch (Exception e) { |
||||
e.printStackTrace(); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,139 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.mainframe.chart.gui.data.DataContentsPane; |
||||
import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.border.Border; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
|
||||
public abstract class AbstractMultiDataContentsPane extends DataContentsPane { |
||||
|
||||
private String dataType; |
||||
private DataChartGroupPane dataChartGroupPane; |
||||
|
||||
public AbstractMultiDataContentsPane(String dataType) { |
||||
this.dataType = dataType; |
||||
} |
||||
|
||||
private List<NormalChartDataPane> paneList; |
||||
|
||||
protected abstract List<NormalChartDataPane> createPaneList(); |
||||
|
||||
public abstract void dataPaneTabChange(String dataType); |
||||
|
||||
private List<NormalChartDataPane> getPaneList() { |
||||
if ((this.paneList == null) || (this.paneList.size() == 0)) { |
||||
this.paneList = createPaneList(); |
||||
} |
||||
return this.paneList; |
||||
} |
||||
|
||||
@Override |
||||
public void setSupportCellData(boolean paramBoolean) { |
||||
Iterator localIterator = getPaneList().iterator(); |
||||
while (localIterator.hasNext()) { |
||||
NormalChartDataPane localAbstractSingleNormalChartDataPane = (NormalChartDataPane) localIterator.next(); |
||||
localAbstractSingleNormalChartDataPane.setSupportCellData(paramBoolean); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void populate(ChartCollection paramChartCollection) { |
||||
Iterator localIterator = getPaneList().iterator(); |
||||
while (localIterator.hasNext()) { |
||||
NormalChartDataPane localAbstractSingleNormalChartDataPane = (NormalChartDataPane) localIterator.next(); |
||||
localAbstractSingleNormalChartDataPane.populate(paramChartCollection); |
||||
} |
||||
dataChartGroupPane.populateBean(this.dataType); |
||||
} |
||||
|
||||
@Override |
||||
public void update(ChartCollection paramChartCollection) { |
||||
Iterator localIterator = getPaneList().iterator(); |
||||
while (localIterator.hasNext()) { |
||||
NormalChartDataPane localAbstractSingleNormalChartDataPane = (NormalChartDataPane) localIterator.next(); |
||||
localAbstractSingleNormalChartDataPane.update(paramChartCollection); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
int i = getPaneList().size(); |
||||
String[] arrayOfString = new String[i]; |
||||
JPanel[] arrayOfJPanel = new JPanel[i]; |
||||
for (int j = 0; j < i; j++) { |
||||
NormalChartDataPane normalChartDataPane = (NormalChartDataPane) getPaneList().get(j); |
||||
arrayOfJPanel[j] = normalChartDataPane; |
||||
arrayOfString[j] = normalChartDataPane.title4PopupWindow(); |
||||
} |
||||
dataChartGroupPane = new DataChartGroupPane(arrayOfString, arrayOfJPanel); |
||||
return dataChartGroupPane; |
||||
} |
||||
|
||||
private class DataChartGroupPane extends JPanel { |
||||
private String[] tilteNames; |
||||
private UIButtonGroup titleGroup; |
||||
private CardLayout dataCardLayout; |
||||
private JPanel cardPane; |
||||
|
||||
public DataChartGroupPane(final String[] var1, final JPanel[] var2) { |
||||
tilteNames = var1; |
||||
titleGroup = new UIButtonGroup(var1); |
||||
titleGroup.setSelectedIndex(0); |
||||
dataCardLayout = new CardLayout(); |
||||
cardPane = new JPanel(dataCardLayout) { |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
return var2[titleGroup.getSelectedIndex()].getPreferredSize(); |
||||
} |
||||
}; |
||||
|
||||
for (int var6 = 0; var6 < var2.length && var6 < var1.length; ++var6) { |
||||
cardPane.add(var2[var6], var1[var6]); |
||||
} |
||||
|
||||
titleGroup.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent var1x) { |
||||
dataCardLayout.show(cardPane, var1[titleGroup.getSelectedIndex()]); |
||||
DataChartGroupPane.this.tabChanged(titleGroup.getSelectedIndex()); |
||||
} |
||||
}); |
||||
titleGroup.setBorder(this.getButtonGroupBorder()); |
||||
this.setLayout(new BorderLayout(0, 4)); |
||||
this.add(titleGroup, "North"); |
||||
this.add(cardPane, "Center"); |
||||
} |
||||
|
||||
public void populateBean(String dataType) { |
||||
if (null != titleGroup) { |
||||
if (StringUtils.isNotEmpty(dataType)) { |
||||
for (int i = 0; i < tilteNames.length; i++) { |
||||
if (dataType.equals(tilteNames[i])) { |
||||
titleGroup.setSelectedIndex(i); |
||||
dataCardLayout.show(cardPane, tilteNames[titleGroup.getSelectedIndex()]); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
protected void tabChanged(int i) { |
||||
NormalChartDataPane normalChartDataPane = (NormalChartDataPane) getPaneList().get(i); |
||||
AbstractMultiDataContentsPane.this.dataPaneTabChange(normalChartDataPane.title4PopupWindow()); |
||||
} |
||||
|
||||
protected Border getButtonGroupBorder() { |
||||
return null; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,68 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
public class CombDataPane extends ChartDataPane { |
||||
|
||||
private PieLineCombChart chart; |
||||
|
||||
public CombDataPane(AttributeChangeListener listener) { |
||||
super(listener); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
String dataType = ""; |
||||
if (null != chart) { |
||||
dataType = chart.getDataType(); |
||||
} |
||||
this.contentsPane = new AbstractMultiDataContentsPane(dataType) { |
||||
@Override |
||||
protected List<NormalChartDataPane> createPaneList() { |
||||
ArrayList localArrayList = new ArrayList(); |
||||
if (null != chart && chart.getChartType() == 0) { |
||||
localArrayList.add(new PieDataPane(CombDataPane.this.listener, CombDataPane.this)); |
||||
} else if (null != chart && chart.getChartType() == 1) { |
||||
localArrayList.add(new LineDataPane(CombDataPane.this.listener, CombDataPane.this)); |
||||
} else { |
||||
localArrayList.add(new PieDataPane(CombDataPane.this.listener, CombDataPane.this)); |
||||
localArrayList.add(new LineDataPane(CombDataPane.this.listener, CombDataPane.this)); |
||||
} |
||||
return localArrayList; |
||||
} |
||||
|
||||
@Override |
||||
public void dataPaneTabChange(String dataType) { |
||||
CombDataPane.this.chart.setDataType(dataType); |
||||
} |
||||
}; |
||||
return this.contentsPane; |
||||
} |
||||
|
||||
protected JPanel createContentPane(ChartCollection paramChartCollection) { |
||||
chart = paramChartCollection.getSelectedChart(PieLineCombChart.class); |
||||
return createContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
protected void repeatLayout(ChartCollection chartCollection) { |
||||
if (this.contentsPane != null) { |
||||
remove(this.contentsPane); |
||||
} |
||||
setLayout(new BorderLayout(0, 0)); |
||||
createContentPane(chartCollection); |
||||
if (this.contentsPane != null) { |
||||
this.contentsPane.setSupportCellData(isSupportCellData()); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,67 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.base.Utils; |
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.extended.chart.AbstractChart; |
||||
import com.fr.extended.chart.AbstractDataConfig; |
||||
import com.fr.extended.chart.DataSet; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class DataUtils { |
||||
public static PieLineCombChart getSelectSubChart(ChartCollection paramChartCollection) { |
||||
return (PieLineCombChart) getSelectedChart(PieLineCombChart.class, paramChartCollection); |
||||
} |
||||
|
||||
public static <T extends Chart> T getSelectedChart(Class<T> paramClass, ChartCollection paramChartCollection) { |
||||
if (paramChartCollection == null) { |
||||
return null; |
||||
} |
||||
return paramChartCollection.getSelectedChart(paramClass); |
||||
} |
||||
|
||||
public static DataSet getSingleDataSet(String paramAbstractDataType, AbstractChart paramAbstractChart) { |
||||
ExtendedMultiDataSet localExtendedMultiDataSet = getMultiDataSet(paramAbstractChart); |
||||
if (localExtendedMultiDataSet != null) { |
||||
return localExtendedMultiDataSet.getSingleDataSet(paramAbstractDataType); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static void putSingleDataSet(String paramAbstractDataType, DataSet paramDataSet, AbstractChart paramAbstractChart) { |
||||
ExtendedMultiDataSet localExtendedMultiDataSet = getMultiDataSet(paramAbstractChart); |
||||
if (localExtendedMultiDataSet != null) { |
||||
localExtendedMultiDataSet.putSingleDataSet(paramAbstractDataType, paramDataSet); |
||||
} else { |
||||
paramAbstractChart.setFilterDefinition(new ExtendedMultiDataSet()); |
||||
} |
||||
} |
||||
|
||||
private static ExtendedMultiDataSet getMultiDataSet(AbstractChart paramAbstractChart) { |
||||
TopDefinitionProvider localTopDefinitionProvider = paramAbstractChart.getFilterDefinition(); |
||||
if ((localTopDefinitionProvider instanceof ExtendedMultiDataSet)) { |
||||
return (ExtendedMultiDataSet) localTopDefinitionProvider; |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static <T extends AbstractDataConfig> T getDataConfig(String paramAbstractDataType, AbstractChart paramAbstractChart) { |
||||
DataSet localDataSet = getSingleDataSet(paramAbstractDataType, paramAbstractChart); |
||||
if (localDataSet == null) { |
||||
return null; |
||||
} |
||||
AbstractDataConfig localAbstractDataConfig = localDataSet.getDataConfig(); |
||||
return (T) localAbstractDataConfig; |
||||
} |
||||
|
||||
public static boolean isReportDataFieldNotSet(List<Object> paramList) { |
||||
return (paramList.size() == 1) && (StringUtils.isEmpty(Utils.objectToString(paramList.get(0)))); |
||||
} |
||||
} |
@ -0,0 +1,144 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.base.chart.chartdata.BaseTableDefinition; |
||||
import com.fr.base.chart.chartdata.ChartData; |
||||
import com.fr.base.chart.chartdata.TopDefinitionProvider; |
||||
import com.fr.base.chart.chartdata.model.DataProcessor; |
||||
import com.fr.base.chart.cross.FormulaProcessor; |
||||
import com.fr.chart.chartdata.TableDataDefinition; |
||||
import com.fr.extended.chart.DataSet; |
||||
import com.fr.extended.chart.ExtendedReportDataSet; |
||||
import com.fr.extended.chart.ExtendedTableDataSet; |
||||
import com.fr.general.data.DataModel; |
||||
import com.fr.general.xml.GeneralXMLTools; |
||||
import com.fr.script.Calculator; |
||||
import com.fr.stable.AssistUtils; |
||||
import com.fr.stable.FCloneable; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLable; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
import java.util.*; |
||||
|
||||
public class ExtendedMultiDataSet extends TableDataDefinition { |
||||
private Map<String, DataSet> multiDataSetMap = new HashMap(); |
||||
|
||||
public DataSet getSingleDataSet(String paramAbstractDataType) |
||||
{ |
||||
return (DataSet)this.multiDataSetMap.get(paramAbstractDataType); |
||||
} |
||||
|
||||
public void putSingleDataSet(String paramAbstractDataType, DataSet paramDataSet) |
||||
{ |
||||
this.multiDataSetMap.put(paramAbstractDataType, paramDataSet); |
||||
} |
||||
|
||||
@Override |
||||
public ChartData calcu4ChartData(Calculator paramCalculator, DataProcessor paramDataProcessor) |
||||
{ |
||||
Iterator localIterator = this.multiDataSetMap.entrySet().iterator(); |
||||
while (localIterator.hasNext()) |
||||
{ |
||||
Map.Entry localEntry = (Map.Entry)localIterator.next(); |
||||
DataSet localDataSet = (DataSet)localEntry.getValue(); |
||||
if ((localDataSet instanceof ExtendedTableDataSet)) { |
||||
((ExtendedTableDataSet)localDataSet).calcu4ChartData(paramCalculator, paramDataProcessor); |
||||
} else if ((localDataSet instanceof ExtendedReportDataSet)) { |
||||
((ExtendedReportDataSet)localDataSet).createChartData(paramCalculator); |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void dealFormula(FormulaProcessor paramFormulaProcessor) |
||||
{ |
||||
super.dealFormula(paramFormulaProcessor); |
||||
Iterator localIterator = this.multiDataSetMap.values().iterator(); |
||||
while (localIterator.hasNext()) |
||||
{ |
||||
DataSet localDataSet = (DataSet)localIterator.next(); |
||||
if ((localDataSet instanceof TopDefinitionProvider)) { |
||||
((TopDefinitionProvider)localDataSet).dealFormula(paramFormulaProcessor); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public ChartData createChartData(DataModel paramDataModel, DataProcessor paramDataProcessor) |
||||
{ |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public List<DataModel> getDataModelList() |
||||
{ |
||||
ArrayList localArrayList = new ArrayList(); |
||||
Iterator localIterator = this.multiDataSetMap.entrySet().iterator(); |
||||
while (localIterator.hasNext()) |
||||
{ |
||||
Map.Entry localEntry = (Map.Entry)localIterator.next(); |
||||
DataSet localDataSet = (DataSet)localEntry.getValue(); |
||||
if ((localDataSet instanceof BaseTableDefinition)) { |
||||
localArrayList.addAll(((BaseTableDefinition)localDataSet).getDataModelList()); |
||||
} |
||||
} |
||||
return localArrayList; |
||||
} |
||||
|
||||
@Override |
||||
public void writeXML(XMLPrintWriter paramXMLPrintWriter) |
||||
{ |
||||
Iterator localIterator = this.multiDataSetMap.entrySet().iterator(); |
||||
while (localIterator.hasNext()) |
||||
{ |
||||
Map.Entry localEntry = (Map.Entry)localIterator.next(); |
||||
String localAbstractDataType = (String)localEntry.getKey(); |
||||
DataSet localDataSet = (DataSet)localEntry.getValue(); |
||||
if ((localDataSet instanceof XMLable)) { |
||||
GeneralXMLTools.writeXMLable(paramXMLPrintWriter, (XMLable)localDataSet, localAbstractDataType); |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void readXML(XMLableReader paramXMLableReader) |
||||
{ |
||||
if (paramXMLableReader.isChildNode()) |
||||
{ |
||||
String str = paramXMLableReader.getTagName(); |
||||
String localAbstractDataType = str; |
||||
this.multiDataSetMap.put(localAbstractDataType, (DataSet)GeneralXMLTools.readXMLable(paramXMLableReader)); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object paramObject) |
||||
{ |
||||
return ((paramObject instanceof ExtendedMultiDataSet)) && (AssistUtils.equals(this.multiDataSetMap, ((ExtendedMultiDataSet)paramObject).multiDataSetMap)); |
||||
} |
||||
|
||||
@Override |
||||
public ExtendedMultiDataSet clone() |
||||
throws CloneNotSupportedException |
||||
{ |
||||
ExtendedMultiDataSet localExtendedMultiDataSet = (ExtendedMultiDataSet)super.clone(); |
||||
HashMap localHashMap = new HashMap(); |
||||
Iterator localIterator = this.multiDataSetMap.entrySet().iterator(); |
||||
while (localIterator.hasNext()) |
||||
{ |
||||
Map.Entry localEntry = (Map.Entry)localIterator.next(); |
||||
String localAbstractDataType = (String)localEntry.getKey(); |
||||
DataSet localDataSet = (DataSet)localEntry.getValue(); |
||||
localHashMap.put(localAbstractDataType, (localDataSet instanceof FCloneable) ? (DataSet)((FCloneable)localDataSet).clone() : localDataSet); |
||||
} |
||||
localExtendedMultiDataSet.multiDataSetMap = localHashMap; |
||||
return localExtendedMultiDataSet; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() |
||||
{ |
||||
return super.hashCode() + AssistUtils.hashCode(new Object[] { this.multiDataSetMap }); |
||||
} |
||||
} |
@ -0,0 +1,83 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.extended.chart.AbstractDataConfig; |
||||
import com.fr.extended.chart.ExtendedField; |
||||
import com.fr.stable.AssistUtils; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/19 |
||||
*/ |
||||
public class LineDataConfig extends AbstractDataConfig { |
||||
|
||||
private ExtendedField category = new ExtendedField(); |
||||
private ExtendedField gridline = new ExtendedField(); |
||||
private ExtendedField regioncolor = new ExtendedField(); |
||||
|
||||
|
||||
@Override |
||||
protected void readAttr(XMLableReader xmLableReader) { |
||||
readExtendedField(category, "category", xmLableReader); |
||||
readExtendedField(gridline, "gridline", xmLableReader); |
||||
readExtendedField(regioncolor, "regioncolor", xmLableReader); |
||||
} |
||||
|
||||
@Override |
||||
protected void writeAttr(XMLPrintWriter xmlPrintWriter) { |
||||
writeExtendedField(category, "category", xmlPrintWriter); |
||||
writeExtendedField(gridline, "gridline", xmlPrintWriter); |
||||
writeExtendedField(regioncolor, "regioncolor", xmlPrintWriter); |
||||
} |
||||
|
||||
@Override |
||||
public ExtendedField[] dataSetFields() { |
||||
return new ExtendedField[]{ |
||||
category, gridline, regioncolor |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public LineDataConfig clone() throws CloneNotSupportedException { |
||||
LineDataConfig result = (LineDataConfig)super.clone(); |
||||
result.setCategory(this.getCategory().clone()); |
||||
result.setGridline(this.getGridline().clone()); |
||||
result.setRegioncolor(this.getRegioncolor().clone()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
return super.equals(obj) |
||||
&& obj instanceof LineDataConfig |
||||
&& AssistUtils.equals(this.getCategory(), ((LineDataConfig) obj).getCategory()) |
||||
&& AssistUtils.equals(this.getGridline(), ((PieDataConfig) obj).getGridline()) |
||||
&& AssistUtils.equals(this.getRegioncolor(), ((PieDataConfig) obj).getRegioncolor()) |
||||
; |
||||
} |
||||
|
||||
public ExtendedField getCategory() { |
||||
return category; |
||||
} |
||||
|
||||
public void setCategory(ExtendedField category) { |
||||
this.category = category; |
||||
} |
||||
|
||||
public ExtendedField getGridline() { |
||||
return gridline; |
||||
} |
||||
|
||||
public void setGridline(ExtendedField gridline) { |
||||
this.gridline = gridline; |
||||
} |
||||
|
||||
public ExtendedField getRegioncolor() { |
||||
return regioncolor; |
||||
} |
||||
|
||||
public void setRegioncolor(ExtendedField regioncolor) { |
||||
this.regioncolor = regioncolor; |
||||
} |
||||
} |
@ -0,0 +1,110 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartdata.ReportDataDefinition; |
||||
import com.fr.chart.chartdata.TableDataDefinition; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.ReportDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.TableDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.extended.chart.*; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
|
||||
public class LineDataPane extends NormalChartDataPane { |
||||
|
||||
|
||||
public LineDataPane(AttributeChangeListener paramAttributeChangeListener, ChartDataPane paramChartDataPane) { |
||||
super(paramAttributeChangeListener, paramChartDataPane); |
||||
} |
||||
|
||||
protected AbstractExtendedChartReportDataPane createReportDataContentPane() { |
||||
return new LineReportDataPane(); |
||||
} |
||||
|
||||
protected AbstractExtendedChartTableDataPane createTableDataContentPane() { |
||||
return new LineTableDataPane(); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-Typeline"); |
||||
} |
||||
|
||||
@Override |
||||
protected TableDataPane getTableDataPane(ChartDataPane chartDataPane) { |
||||
TableDataPane tdp = new TableDataPane(chartDataPane) { |
||||
private AbstractExtendedChartTableDataPane pane; |
||||
|
||||
@Override |
||||
protected AbstractTableDataContentPane getContentPane(Chart paramAnonymousChart) { |
||||
this.pane = LineDataPane.this.createTableDataContentPane(); |
||||
return this.pane; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ChartCollection paramAnonymousChartCollection) { |
||||
AbstractChart localAbstractChart = paramAnonymousChartCollection.getSelectedChart(PieLineCombChart.class); |
||||
if (localAbstractChart != null) { |
||||
DataSet localDataSet = DataUtils.getSingleDataSet(PieLineCombChart.LINE_DATA, localAbstractChart); |
||||
if (accept(paramAnonymousChartCollection)) { |
||||
populateDSName((TableDataDefinition) localDataSet); |
||||
} |
||||
this.pane.populateDataSet(localDataSet); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(ChartCollection paramAnonymousChartCollection) { |
||||
AbstractChart localAbstractChart = DataUtils.getSelectSubChart(paramAnonymousChartCollection); |
||||
ExtendedTableDataSet localExtendedTableDataSet = this.pane.updateDataSet(); |
||||
updateDSName(localExtendedTableDataSet); |
||||
DataUtils.putSingleDataSet(PieLineCombChart.LINE_DATA, localExtendedTableDataSet, localAbstractChart); |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object paramAnonymousObject) { |
||||
return true; |
||||
} |
||||
}; |
||||
|
||||
return tdp; |
||||
} |
||||
|
||||
@Override |
||||
protected ReportDataPane getReportDataPane(ChartDataPane paramChartDataPane) { |
||||
return new ReportDataPane(paramChartDataPane) { |
||||
private AbstractExtendedChartReportDataPane pane; |
||||
|
||||
@Override |
||||
protected AbstractReportDataContentPane getContentPane(Chart paramAnonymousChart) { |
||||
this.pane = LineDataPane.this.createReportDataContentPane(); |
||||
return this.pane; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ChartCollection paramAnonymousChartCollection) { |
||||
AbstractChart localAbstractChart = DataUtils.getSelectSubChart(paramAnonymousChartCollection); |
||||
if (localAbstractChart != null) { |
||||
DataSet localDataSet = DataUtils.getSingleDataSet(PieLineCombChart.LINE_DATA, localAbstractChart); |
||||
this.pane.populateDataSet(localDataSet); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(ChartCollection paramAnonymousChartCollection) { |
||||
AbstractChart localAbstractChart = DataUtils.getSelectSubChart(paramAnonymousChartCollection); |
||||
DataUtils.putSingleDataSet(PieLineCombChart.LINE_DATA, this.pane.updateDataSet(), localAbstractChart); |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object paramAnonymousObject) { |
||||
return ((paramAnonymousObject instanceof ChartCollection)) && ((DataUtils.getSingleDataSet(PieLineCombChart.LINE_DATA, DataUtils.getSelectSubChart((ChartCollection) paramAnonymousObject)) instanceof ReportDataDefinition)); |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.extended.chart.AbstractExtendedChartReportDataPane; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/19 |
||||
*/ |
||||
public class LineReportDataPane extends AbstractExtendedChartReportDataPane<LineDataConfig> { |
||||
private TinyFormulaPane category; |
||||
private TinyFormulaPane gridline; |
||||
private TinyFormulaPane regioncolor; |
||||
|
||||
|
||||
@Override |
||||
protected boolean hasCustomFieldPane() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] fieldLabel() { |
||||
return new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-category"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-gridline"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-regioncolor") |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected TinyFormulaPane[] formulaPanes() { |
||||
if (null == category) { |
||||
this.category = new TinyFormulaPane(); |
||||
} |
||||
if (this.gridline == null) { |
||||
this.gridline = new TinyFormulaPane(); |
||||
} |
||||
if (this.regioncolor == null) { |
||||
this.regioncolor = new TinyFormulaPane(); |
||||
} |
||||
return new TinyFormulaPane[]{ |
||||
category, gridline, regioncolor |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected void populate(LineDataConfig dataConfig) { |
||||
populateField(this.category, dataConfig.getCategory()); |
||||
populateField(this.gridline, dataConfig.getGridline()); |
||||
populateField(this.regioncolor, dataConfig.getRegioncolor()); |
||||
} |
||||
|
||||
@Override |
||||
protected LineDataConfig update() { |
||||
LineDataConfig dataConfig = new LineDataConfig(); |
||||
updateField(this.category, dataConfig.getCategory()); |
||||
updateField(this.gridline, dataConfig.getGridline()); |
||||
updateField(this.regioncolor, dataConfig.getRegioncolor()); |
||||
return dataConfig; |
||||
} |
||||
} |
@ -0,0 +1,69 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.extended.chart.AbstractExtendedChartTableDataPane; |
||||
import com.fr.extended.chart.ExtendedCustomFieldComboBoxPane; |
||||
import com.fr.extended.chart.UIComboBoxWithNone; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/19 |
||||
*/ |
||||
public class LineTableDataPane extends AbstractExtendedChartTableDataPane<LineDataConfig> { |
||||
private UIComboBoxWithNone category; |
||||
private UIComboBoxWithNone gridline; |
||||
private UIComboBoxWithNone regioncolor; |
||||
|
||||
|
||||
@Override |
||||
protected ExtendedCustomFieldComboBoxPane createExtendedCustomFieldComboBoxPane() { |
||||
return new ExtendedCustomFieldComboBoxPane(){ |
||||
@Override |
||||
protected boolean valueComboBoxHasNone() { |
||||
return true; |
||||
} |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] fieldLabels() { |
||||
return new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-category"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-gridline"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-regioncolor") |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected UIComboBox[] filedComboBoxes() { |
||||
if (this.category == null) { |
||||
this.category = new UIComboBoxWithNone(); |
||||
} |
||||
if (this.gridline == null) { |
||||
this.gridline = new UIComboBoxWithNone(); |
||||
} |
||||
if (this.regioncolor == null) { |
||||
this.regioncolor = new UIComboBoxWithNone(); |
||||
} |
||||
return new UIComboBox[]{ |
||||
category, gridline, regioncolor |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected void populate(LineDataConfig dataConfig) { |
||||
populateField(this.category, dataConfig.getCategory()); |
||||
populateField(this.gridline, dataConfig.getGridline()); |
||||
populateField(this.regioncolor, dataConfig.getRegioncolor()); |
||||
} |
||||
|
||||
@Override |
||||
protected LineDataConfig update() { |
||||
LineDataConfig dataConfig = new LineDataConfig(); |
||||
updateField(this.category, dataConfig.getCategory()); |
||||
updateField(this.gridline, dataConfig.getGridline()); |
||||
updateField(this.regioncolor, dataConfig.getRegioncolor()); |
||||
return dataConfig; |
||||
} |
||||
} |
@ -0,0 +1,82 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.extended.chart.AbstractDataConfig; |
||||
import com.fr.extended.chart.ExtendedField; |
||||
import com.fr.stable.AssistUtils; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/19 |
||||
*/ |
||||
public class PieDataConfig extends AbstractDataConfig { |
||||
|
||||
private ExtendedField category = new ExtendedField(); |
||||
private ExtendedField gridline = new ExtendedField(); |
||||
private ExtendedField regioncolor = new ExtendedField(); |
||||
|
||||
@Override |
||||
protected void readAttr(XMLableReader xmLableReader) { |
||||
readExtendedField(category, "category", xmLableReader); |
||||
readExtendedField(gridline, "gridline", xmLableReader); |
||||
readExtendedField(regioncolor, "regioncolor", xmLableReader); |
||||
} |
||||
|
||||
@Override |
||||
protected void writeAttr(XMLPrintWriter xmlPrintWriter) { |
||||
writeExtendedField(category, "category", xmlPrintWriter); |
||||
writeExtendedField(gridline, "gridline", xmlPrintWriter); |
||||
writeExtendedField(regioncolor, "regioncolor", xmlPrintWriter); |
||||
} |
||||
|
||||
@Override |
||||
public ExtendedField[] dataSetFields() { |
||||
return new ExtendedField[]{ |
||||
category, gridline, regioncolor |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public PieDataConfig clone() throws CloneNotSupportedException { |
||||
PieDataConfig result = (PieDataConfig)super.clone(); |
||||
result.setCategory(this.getCategory().clone()); |
||||
result.setGridline(this.getGridline().clone()); |
||||
result.setRegioncolor(this.getRegioncolor().clone()); |
||||
return result; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
return super.equals(obj) |
||||
&& obj instanceof PieDataConfig |
||||
&& AssistUtils.equals(this.getCategory(), ((PieDataConfig) obj).getCategory()) |
||||
&& AssistUtils.equals(this.getGridline(), ((PieDataConfig) obj).getGridline()) |
||||
&& AssistUtils.equals(this.getRegioncolor(), ((PieDataConfig) obj).getRegioncolor()) |
||||
; |
||||
} |
||||
|
||||
public ExtendedField getCategory() { |
||||
return category; |
||||
} |
||||
|
||||
public void setCategory(ExtendedField category) { |
||||
this.category = category; |
||||
} |
||||
|
||||
public ExtendedField getGridline() { |
||||
return gridline; |
||||
} |
||||
|
||||
public void setGridline(ExtendedField gridline) { |
||||
this.gridline = gridline; |
||||
} |
||||
|
||||
public ExtendedField getRegioncolor() { |
||||
return regioncolor; |
||||
} |
||||
|
||||
public void setRegioncolor(ExtendedField regioncolor) { |
||||
this.regioncolor = regioncolor; |
||||
} |
||||
} |
@ -0,0 +1,110 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.chart.chartattr.Chart; |
||||
import com.fr.chart.chartattr.ChartCollection; |
||||
import com.fr.chart.chartdata.ReportDataDefinition; |
||||
import com.fr.chart.chartdata.TableDataDefinition; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.chart.gui.ChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.NormalChartDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.ReportDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.TableDataPane; |
||||
import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPane; |
||||
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; |
||||
import com.fr.extended.chart.*; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
|
||||
public class PieDataPane extends NormalChartDataPane { |
||||
|
||||
|
||||
public PieDataPane(AttributeChangeListener paramAttributeChangeListener, ChartDataPane paramChartDataPane) { |
||||
super(paramAttributeChangeListener, paramChartDataPane); |
||||
} |
||||
|
||||
protected AbstractExtendedChartReportDataPane createReportDataContentPane() { |
||||
return new PieReportDataPane(); |
||||
} |
||||
|
||||
protected AbstractExtendedChartTableDataPane createTableDataContentPane() { |
||||
return new PieTableDataPane(); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-Typepie"); |
||||
} |
||||
|
||||
@Override |
||||
protected TableDataPane getTableDataPane(ChartDataPane chartDataPane) { |
||||
TableDataPane tdp = new TableDataPane(chartDataPane) { |
||||
private AbstractExtendedChartTableDataPane pane; |
||||
|
||||
@Override |
||||
protected AbstractTableDataContentPane getContentPane(Chart paramAnonymousChart) { |
||||
this.pane = PieDataPane.this.createTableDataContentPane(); |
||||
return this.pane; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ChartCollection paramAnonymousChartCollection) { |
||||
AbstractChart localAbstractChart = paramAnonymousChartCollection.getSelectedChart(PieLineCombChart.class); |
||||
if (localAbstractChart != null) { |
||||
DataSet localDataSet = DataUtils.getSingleDataSet(PieLineCombChart.PIE_DATA, localAbstractChart); |
||||
if (accept(paramAnonymousChartCollection)) { |
||||
populateDSName((TableDataDefinition) localDataSet); |
||||
} |
||||
this.pane.populateDataSet(localDataSet); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(ChartCollection paramAnonymousChartCollection) { |
||||
AbstractChart localAbstractChart = DataUtils.getSelectSubChart(paramAnonymousChartCollection); |
||||
ExtendedTableDataSet localExtendedTableDataSet = this.pane.updateDataSet(); |
||||
updateDSName(localExtendedTableDataSet); |
||||
DataUtils.putSingleDataSet(PieLineCombChart.PIE_DATA, localExtendedTableDataSet, localAbstractChart); |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object paramAnonymousObject) { |
||||
return true; |
||||
} |
||||
}; |
||||
|
||||
return tdp; |
||||
} |
||||
|
||||
@Override |
||||
protected ReportDataPane getReportDataPane(ChartDataPane paramChartDataPane) { |
||||
return new ReportDataPane(paramChartDataPane) { |
||||
private AbstractExtendedChartReportDataPane pane; |
||||
|
||||
@Override |
||||
protected AbstractReportDataContentPane getContentPane(Chart paramAnonymousChart) { |
||||
this.pane = PieDataPane.this.createReportDataContentPane(); |
||||
return this.pane; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ChartCollection paramAnonymousChartCollection) { |
||||
AbstractChart localAbstractChart = DataUtils.getSelectSubChart(paramAnonymousChartCollection); |
||||
if (localAbstractChart != null) { |
||||
DataSet localDataSet = DataUtils.getSingleDataSet(PieLineCombChart.PIE_DATA, localAbstractChart); |
||||
this.pane.populateDataSet(localDataSet); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(ChartCollection paramAnonymousChartCollection) { |
||||
AbstractChart localAbstractChart = DataUtils.getSelectSubChart(paramAnonymousChartCollection); |
||||
DataUtils.putSingleDataSet(PieLineCombChart.PIE_DATA, this.pane.updateDataSet(), localAbstractChart); |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object paramAnonymousObject) { |
||||
return ((paramAnonymousObject instanceof ChartCollection)) && ((DataUtils.getSingleDataSet(PieLineCombChart.PIE_DATA, DataUtils.getSelectSubChart((ChartCollection) paramAnonymousObject)) instanceof ReportDataDefinition)); |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.extended.chart.AbstractExtendedChartReportDataPane; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/19 |
||||
*/ |
||||
public class PieReportDataPane extends AbstractExtendedChartReportDataPane<PieDataConfig> { |
||||
|
||||
private TinyFormulaPane category; |
||||
private TinyFormulaPane gridline; |
||||
private TinyFormulaPane regioncolor; |
||||
|
||||
@Override |
||||
protected boolean hasCustomFieldPane() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] fieldLabel() { |
||||
return new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-category"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-gridline"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-regioncolor") |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected TinyFormulaPane[] formulaPanes() { |
||||
if (null == category) { |
||||
this.category = new TinyFormulaPane(); |
||||
} |
||||
if (this.gridline == null) { |
||||
this.gridline = new TinyFormulaPane(); |
||||
} |
||||
if (this.regioncolor == null) { |
||||
this.regioncolor = new TinyFormulaPane(); |
||||
} |
||||
return new TinyFormulaPane[]{ |
||||
category, gridline, regioncolor |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected void populate(PieDataConfig dataConfig) { |
||||
populateField(this.category, dataConfig.getCategory()); |
||||
populateField(this.gridline, dataConfig.getGridline()); |
||||
populateField(this.regioncolor, dataConfig.getRegioncolor()); |
||||
} |
||||
|
||||
@Override |
||||
protected PieDataConfig update() { |
||||
PieDataConfig dataConfig = new PieDataConfig(); |
||||
updateField(this.category, dataConfig.getCategory()); |
||||
updateField(this.gridline, dataConfig.getGridline()); |
||||
updateField(this.regioncolor, dataConfig.getRegioncolor()); |
||||
return dataConfig; |
||||
} |
||||
} |
@ -0,0 +1,69 @@
|
||||
package com.fr.plugin.pielinecomb.data; |
||||
|
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.extended.chart.AbstractExtendedChartTableDataPane; |
||||
import com.fr.extended.chart.ExtendedCustomFieldComboBoxPane; |
||||
import com.fr.extended.chart.UIComboBoxWithNone; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/19 |
||||
*/ |
||||
public class PieTableDataPane extends AbstractExtendedChartTableDataPane<PieDataConfig> { |
||||
private UIComboBoxWithNone category; |
||||
private UIComboBoxWithNone gridline; |
||||
private UIComboBoxWithNone regioncolor; |
||||
|
||||
|
||||
@Override |
||||
protected ExtendedCustomFieldComboBoxPane createExtendedCustomFieldComboBoxPane() { |
||||
return new ExtendedCustomFieldComboBoxPane(){ |
||||
@Override |
||||
protected boolean valueComboBoxHasNone() { |
||||
return true; |
||||
} |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected String[] fieldLabels() { |
||||
return new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-category"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-gridline"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-regioncolor") |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected UIComboBox[] filedComboBoxes() { |
||||
if (this.category == null) { |
||||
this.category = new UIComboBoxWithNone(); |
||||
} |
||||
if (this.gridline == null) { |
||||
this.gridline = new UIComboBoxWithNone(); |
||||
} |
||||
if (this.regioncolor == null) { |
||||
this.regioncolor = new UIComboBoxWithNone(); |
||||
} |
||||
return new UIComboBox[]{ |
||||
category, gridline, regioncolor |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected void populate(PieDataConfig dataConfig) { |
||||
populateField(this.category, dataConfig.getCategory()); |
||||
populateField(this.gridline, dataConfig.getGridline()); |
||||
populateField(this.regioncolor, dataConfig.getRegioncolor()); |
||||
} |
||||
|
||||
@Override |
||||
protected PieDataConfig update() { |
||||
PieDataConfig dataConfig = new PieDataConfig(); |
||||
updateField(this.category, dataConfig.getCategory()); |
||||
updateField(this.gridline, dataConfig.getGridline()); |
||||
updateField(this.regioncolor, dataConfig.getRegioncolor()); |
||||
return dataConfig; |
||||
} |
||||
} |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 2.9 KiB |
@ -0,0 +1,107 @@
|
||||
Plugin-Pielinecomb-Typepie=\u67F1\u5F62\u56FE |
||||
Plugin-Pielinecomb-Typeline=\u6298\u7EBF\u56FE |
||||
Plugin-Pielinecomb-Typecomb=\u67F1\u5F62\u6298\u7EBF\u7EC4\u5408\u56FE |
||||
|
||||
Plugin-Pielinecomb-category=\u5206\u7C7B |
||||
Plugin-Pielinecomb-gridline=\u7F51\u683C\u7EBF |
||||
Plugin-Pielinecomb-regioncolor=\u80CC\u666F\u8272 |
||||
|
||||
Plugin-Pielinecomb-isVisiableTitle=\u663E\u793A\u6807\u9898 |
||||
Plugin-Pielinecomb-titleBgColor=\u80CC\u666F\u989C\u8272 |
||||
Plugin-Pielinecomb-titleBgOpacity=\u4E0D\u900F\u660E\u5EA6 |
||||
Plugin-Pielinecomb-TitleText=\u5185\u5BB9 |
||||
Plugin-Pielinecomb-TitlePosition=\u4F4D\u7F6E |
||||
Plugin-Pielinecomb-TitleExpand=\u6807\u9898\u8BBE\u7F6E |
||||
Plugin-Pielinecomb-TitleStyle=\u6837\u5F0F |
||||
Plugin-Pielinecomb-TitleNameExpand=\u6807\u9898 |
||||
Plugin-Pielinecomb-bgExpand=\u80CC\u666F |
||||
|
||||
Plugin-Pielinecomb-StyleLegendTitle=\u56FE\u4F8B |
||||
Plugin-Pielinecomb-showylegend=\u663E\u793A\u56FE\u4F8B |
||||
Plugin-Pielinecomb-legendposition=\u65B9\u4F4D |
||||
Plugin-Pielinecomb-legendalignment=\u4F4D\u7F6E |
||||
Plugin-Pielinecomb-legendmargin=\u8FB9\u8DDD |
||||
Plugin-Pielinecomb-ChartLegendPositionExpand=\u56FE\u4F8B\u4F4D\u7F6E |
||||
|
||||
Plugin-Pielinecomb-auto=\u81EA\u52A8 |
||||
Plugin-Pielinecomb-general=\u901A\u7528 |
||||
Plugin-Pielinecomb-custom=\u81EA\u5B9A\u4E49 |
||||
Plugin-Pielinecomb-layout=\u5E03\u5C40 |
||||
Plugin-Pielinecomb-format=\u683C\u5F0F |
||||
Plugin-Pielinecomb-condition=\u6761\u4EF6 |
||||
Plugin-Pielinecomb-textDirection=\u6587\u672C\u65B9\u5411 |
||||
Plugin-Pielinecomb-DirectOrientation=\u6A2A\u5411 |
||||
Plugin-Pielinecomb-DirectVertical=\u7EB5\u5411 |
||||
Plugin-Pielinecomb-left=\u5DE6\u4FA7 |
||||
Plugin-Pielinecomb-right=\u53F3\u4FA7 |
||||
Plugin-Pielinecomb-hyperLink=\u8D85\u7EA7\u94FE\u63A5 |
||||
Plugin-Pielinecomb-color=\u914D\u8272 |
||||
|
||||
Plugin-Pielinecomb-StyleSeriesTitle=\u7CFB\u5217 |
||||
Plugin-Pielinecomb-posoutside=\u5916\u4FA7 |
||||
Plugin-Pielinecomb-posinside=\u5185\u4FA7 |
||||
Plugin-Pielinecomb-poscenter=\u5C45\u4E2D |
||||
Plugin-Pielinecomb-postop=\u4E0A\u65B9 |
||||
Plugin-Pielinecomb-posbottom=\u4E0B\u65B9 |
||||
Plugin-Pielinecomb-StyleLegendLabel=\u6807\u7B7E |
||||
Plugin-Pielinecomb-showPieLabel=\u663E\u793A\u6807\u7B7E |
||||
Plugin-Pielinecomb-showPieCategory=\u5206\u7C7B\u540D |
||||
Plugin-Pielinecomb-showPieSeries=\u7CFB\u5217\u540D |
||||
Plugin-Pielinecomb-showPieValue=\u6570\u503C |
||||
Plugin-Pielinecomb-brokenLine=\u6298\u7EBF |
||||
Plugin-Pielinecomb-smoothLine=\u66F2\u7EBF |
||||
|
||||
Plugin-Pielinecomb-barWidthLabel=\u67F1\u5BBD\u65B9\u5F0F |
||||
Plugin-Pielinecomb-barWidth=\u5BBD\u5EA6 |
||||
Plugin-Pielinecomb-seriesGapWidth=\u7CFB\u5217\u95F4\u9694 |
||||
|
||||
Plugin-Pielinecomb-seriesColor=\u7CFB\u5217\u8272 |
||||
Plugin-Pielinecomb-customColor=\u81EA\u5B9A\u4E49\u989C\u8272 |
||||
Plugin-Pielinecomb-Default=\u9ED8\u8BA4 |
||||
Plugin-Pielinecomb-shapeCircle=\u5706\u5F62 |
||||
Plugin-Pielinecomb-shapeRect=\u6B63\u65B9\u5F62 |
||||
Plugin-Pielinecomb-shapeTriangle=\u4E09\u89D2\u5F62 |
||||
Plugin-Pielinecomb-shapeDiamond=\u83F1\u5F62 |
||||
|
||||
Plugin-Pielinecomb-lineType=\u7EBF\u578B |
||||
Plugin-Pielinecomb-lineWidth=\u7EBF\u5BBD |
||||
Plugin-Pielinecomb-lineCornerType=\u5F62\u6001 |
||||
|
||||
Plugin-Pielinecomb-lineCornerShape=\u70B9\u6837\u5F0F |
||||
Plugin-Pielinecomb-lineCornerColorType=\u586B\u5145\u989C\u8272 |
||||
Plugin-Pielinecomb-lineCornerRadius=\u534A\u5F84 |
||||
Plugin-Pielinecomb-LineStyle=\u7EBF\u6837\u5F0F |
||||
Plugin-Pielinecomb-CornerStyle=\u6807\u8BB0\u70B9 |
||||
|
||||
Plugin-Pielinecomb-StyleAxisTitle=\u5750\u6807\u8F74 |
||||
Plugin-Pielinecomb-StyleAxisXTitle=X\u8F74 |
||||
Plugin-Pielinecomb-StyleAxisYTitle=Y\u8F74 |
||||
Plugin-Pielinecomb-textRotation=\u6587\u672C\u65CB\u8F6C |
||||
Plugin-Pielinecomb-isLabelVisiable=\u663E\u793A\u6807\u7B7E |
||||
Plugin-Pielinecomb-axisLabelTitle=\u8F74\u6807\u7B7E |
||||
Plugin-Pielinecomb-labelFormatType=\u8F74\u6807\u7B7E\u683C\u5F0F |
||||
Plugin-Pielinecomb-yAxisPosition=\u8F74\u6807\u7B7E\u4F4D\u7F6E |
||||
Plugin-Pielinecomb-valueDefined=\u503C\u5B9A\u4E49 |
||||
Plugin-Pielinecomb-minValue=\u81EA\u5B9A\u4E49\u6700\u5C0F\u503C |
||||
Plugin-Pielinecomb-maxValue=\u81EA\u5B9A\u4E49\u6700\u5927\u503C |
||||
Plugin-Pielinecomb-intervalValue=\u81EA\u5B9A\u4E49\u523B\u5EA6\u503C |
||||
|
||||
Plugin-Pielinecomb-showPieTip=\u663E\u793A\u63D0\u793A |
||||
Plugin-Pielinecomb-StyleLegendTips=\u63D0\u793A |
||||
Plugin-Pielinecomb-Cond-AddCondtion=\u6DFB\u52A0 |
||||
Plugin-Pielinecomb-Cond-clearButton=\u6E05\u7A7A |
||||
Plugin-Pielinecomb-styleCondition=\u6837\u5F0F\u6761\u4EF6\u5C5E\u6027 |
||||
Plugin-Pielinecomb-AnimalTitle=\u7279\u6548 |
||||
|
||||
Plugin-Pielinecomb-lineColor=\u7F51\u683C\u7EBF\u989C\u8272 |
||||
Plugin-Pielinecomb-bgGridX=Y\u8F74\u7F51\u683C\u7EBF |
||||
Plugin-Pielinecomb-StyleBgTitle=\u80CC\u666F |
||||
Plugin-Pielinecomb-BgXTitleStyle=X\u8F74\u80CC\u666F |
||||
Plugin-Pielinecomb-fixHeight=\u56FA\u5B9A\u95F4\u9694 |
||||
Plugin-Pielinecomb-BgYTitleStyle=Y\u8F74\u80CC\u666F |
||||
Plugin-Pielinecomb-Cond-CustomGrid=\u81EA\u5B9A\u4E49\u7F51\u683C |
||||
Plugin-Pielinecomb-bgChartType=\u914D\u7F6E\u6570\u636E |
||||
Plugin-Pielinecomb-seriesAxisRela=\u7CFB\u5217\u5750\u6807\u914D\u7F6E |
||||
Plugin-Pielinecomb-seriesAxis=\u7CFB\u5217\u5750\u6807 |
||||
|
||||
Plugin-Pielinecomb-isShowZoomTool=\u663E\u793A\u6570\u636E\u7F29\u653E\u7EC4\u4EF6 |
@ -0,0 +1,107 @@
|
||||
Plugin-Pielinecomb-Typepie=\u67F1\u5F62\u56FE |
||||
Plugin-Pielinecomb-Typeline=\u6298\u7EBF\u56FE |
||||
Plugin-Pielinecomb-Typecomb=\u67F1\u5F62\u6298\u7EBF\u7EC4\u5408\u56FE |
||||
|
||||
Plugin-Pielinecomb-category=\u5206\u7C7B |
||||
Plugin-Pielinecomb-gridline=\u7F51\u683C\u7EBF |
||||
Plugin-Pielinecomb-regioncolor=\u80CC\u666F\u8272 |
||||
|
||||
Plugin-Pielinecomb-isVisiableTitle=\u663E\u793A\u6807\u9898 |
||||
Plugin-Pielinecomb-titleBgColor=\u80CC\u666F\u989C\u8272 |
||||
Plugin-Pielinecomb-titleBgOpacity=\u4E0D\u900F\u660E\u5EA6 |
||||
Plugin-Pielinecomb-TitleText=\u5185\u5BB9 |
||||
Plugin-Pielinecomb-TitlePosition=\u4F4D\u7F6E |
||||
Plugin-Pielinecomb-TitleExpand=\u6807\u9898\u8BBE\u7F6E |
||||
Plugin-Pielinecomb-TitleStyle=\u6837\u5F0F |
||||
Plugin-Pielinecomb-TitleNameExpand=\u6807\u9898 |
||||
Plugin-Pielinecomb-bgExpand=\u80CC\u666F |
||||
|
||||
Plugin-Pielinecomb-StyleLegendTitle=\u56FE\u4F8B |
||||
Plugin-Pielinecomb-showylegend=\u663E\u793A\u56FE\u4F8B |
||||
Plugin-Pielinecomb-legendposition=\u65B9\u4F4D |
||||
Plugin-Pielinecomb-legendalignment=\u4F4D\u7F6E |
||||
Plugin-Pielinecomb-legendmargin=\u8FB9\u8DDD |
||||
Plugin-Pielinecomb-ChartLegendPositionExpand=\u56FE\u4F8B\u4F4D\u7F6E |
||||
|
||||
Plugin-Pielinecomb-auto=\u81EA\u52A8 |
||||
Plugin-Pielinecomb-general=\u901A\u7528 |
||||
Plugin-Pielinecomb-custom=\u81EA\u5B9A\u4E49 |
||||
Plugin-Pielinecomb-layout=\u5E03\u5C40 |
||||
Plugin-Pielinecomb-format=\u683C\u5F0F |
||||
Plugin-Pielinecomb-condition=\u6761\u4EF6 |
||||
Plugin-Pielinecomb-textDirection=\u6587\u672C\u65B9\u5411 |
||||
Plugin-Pielinecomb-DirectOrientation=\u6A2A\u5411 |
||||
Plugin-Pielinecomb-DirectVertical=\u7EB5\u5411 |
||||
Plugin-Pielinecomb-left=\u5DE6\u4FA7 |
||||
Plugin-Pielinecomb-right=\u53F3\u4FA7 |
||||
Plugin-Pielinecomb-hyperLink=\u8D85\u7EA7\u94FE\u63A5 |
||||
Plugin-Pielinecomb-color=\u914D\u8272 |
||||
|
||||
Plugin-Pielinecomb-StyleSeriesTitle=\u7CFB\u5217 |
||||
Plugin-Pielinecomb-posoutside=\u5916\u4FA7 |
||||
Plugin-Pielinecomb-posinside=\u5185\u4FA7 |
||||
Plugin-Pielinecomb-poscenter=\u5C45\u4E2D |
||||
Plugin-Pielinecomb-postop=\u4E0A\u65B9 |
||||
Plugin-Pielinecomb-posbottom=\u4E0B\u65B9 |
||||
Plugin-Pielinecomb-StyleLegendLabel=\u6807\u7B7E |
||||
Plugin-Pielinecomb-showPieLabel=\u663E\u793A\u6807\u7B7E |
||||
Plugin-Pielinecomb-showPieCategory=\u5206\u7C7B\u540D |
||||
Plugin-Pielinecomb-showPieSeries=\u7CFB\u5217\u540D |
||||
Plugin-Pielinecomb-showPieValue=\u6570\u503C |
||||
Plugin-Pielinecomb-brokenLine=\u6298\u7EBF |
||||
Plugin-Pielinecomb-smoothLine=\u66F2\u7EBF |
||||
|
||||
Plugin-Pielinecomb-barWidthLabel=\u67F1\u5BBD\u65B9\u5F0F |
||||
Plugin-Pielinecomb-barWidth=\u5BBD\u5EA6 |
||||
Plugin-Pielinecomb-seriesGapWidth=\u7CFB\u5217\u95F4\u9694 |
||||
|
||||
Plugin-Pielinecomb-seriesColor=\u7CFB\u5217\u8272 |
||||
Plugin-Pielinecomb-customColor=\u81EA\u5B9A\u4E49\u989C\u8272 |
||||
Plugin-Pielinecomb-Default=\u9ED8\u8BA4 |
||||
Plugin-Pielinecomb-shapeCircle=\u5706\u5F62 |
||||
Plugin-Pielinecomb-shapeRect=\u6B63\u65B9\u5F62 |
||||
Plugin-Pielinecomb-shapeTriangle=\u4E09\u89D2\u5F62 |
||||
Plugin-Pielinecomb-shapeDiamond=\u83F1\u5F62 |
||||
|
||||
Plugin-Pielinecomb-lineType=\u7EBF\u578B |
||||
Plugin-Pielinecomb-lineWidth=\u7EBF\u5BBD |
||||
Plugin-Pielinecomb-lineCornerType=\u5F62\u6001 |
||||
|
||||
Plugin-Pielinecomb-lineCornerShape=\u70B9\u6837\u5F0F |
||||
Plugin-Pielinecomb-lineCornerColorType=\u586B\u5145\u989C\u8272 |
||||
Plugin-Pielinecomb-lineCornerRadius=\u534A\u5F84 |
||||
Plugin-Pielinecomb-LineStyle=\u7EBF\u6837\u5F0F |
||||
Plugin-Pielinecomb-CornerStyle=\u6807\u8BB0\u70B9 |
||||
|
||||
Plugin-Pielinecomb-StyleAxisTitle=\u5750\u6807\u8F74 |
||||
Plugin-Pielinecomb-StyleAxisXTitle=X\u8F74 |
||||
Plugin-Pielinecomb-StyleAxisYTitle=Y\u8F74 |
||||
Plugin-Pielinecomb-textRotation=\u6587\u672C\u65CB\u8F6C |
||||
Plugin-Pielinecomb-isLabelVisiable=\u663E\u793A\u6807\u7B7E |
||||
Plugin-Pielinecomb-axisLabelTitle=\u8F74\u6807\u7B7E |
||||
Plugin-Pielinecomb-labelFormatType=\u8F74\u6807\u7B7E\u683C\u5F0F |
||||
Plugin-Pielinecomb-yAxisPosition=\u8F74\u6807\u7B7E\u4F4D\u7F6E |
||||
Plugin-Pielinecomb-valueDefined=\u503C\u5B9A\u4E49 |
||||
Plugin-Pielinecomb-minValue=\u81EA\u5B9A\u4E49\u6700\u5C0F\u503C |
||||
Plugin-Pielinecomb-maxValue=\u81EA\u5B9A\u4E49\u6700\u5927\u503C |
||||
Plugin-Pielinecomb-intervalValue=\u81EA\u5B9A\u4E49\u523B\u5EA6\u503C |
||||
|
||||
Plugin-Pielinecomb-showPieTip=\u663E\u793A\u63D0\u793A |
||||
Plugin-Pielinecomb-StyleLegendTips=\u63D0\u793A |
||||
Plugin-Pielinecomb-Cond-AddCondtion=\u6DFB\u52A0 |
||||
Plugin-Pielinecomb-Cond-clearButton=\u6E05\u7A7A |
||||
Plugin-Pielinecomb-styleCondition=\u6837\u5F0F\u6761\u4EF6\u5C5E\u6027 |
||||
Plugin-Pielinecomb-AnimalTitle=\u7279\u6548 |
||||
|
||||
Plugin-Pielinecomb-lineColor=\u7F51\u683C\u7EBF\u989C\u8272 |
||||
Plugin-Pielinecomb-bgGridX=Y\u8F74\u7F51\u683C\u7EBF |
||||
Plugin-Pielinecomb-StyleBgTitle=\u80CC\u666F |
||||
Plugin-Pielinecomb-BgXTitleStyle=X\u8F74\u80CC\u666F |
||||
Plugin-Pielinecomb-fixHeight=\u56FA\u5B9A\u95F4\u9694 |
||||
Plugin-Pielinecomb-BgYTitleStyle=Y\u8F74\u80CC\u666F |
||||
Plugin-Pielinecomb-Cond-CustomGrid=\u81EA\u5B9A\u4E49\u7F51\u683C |
||||
Plugin-Pielinecomb-bgChartType=\u914D\u7F6E\u6570\u636E |
||||
Plugin-Pielinecomb-seriesAxisRela=\u7CFB\u5217\u5750\u6807\u914D\u7F6E |
||||
Plugin-Pielinecomb-seriesAxis=\u7CFB\u5217\u5750\u6807 |
||||
|
||||
Plugin-Pielinecomb-isShowZoomTool=\u663E\u793A\u6570\u636E\u7F29\u653E\u7EC4\u4EF6 |
@ -0,0 +1,100 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.vo.BgGridXJson; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.van.chart.designer.AbstractVanChartScrollPane; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class BgGridCondCreator extends AbstractVanChartScrollPane<CustomJsonObject> { |
||||
|
||||
private UISpinner valueY; |
||||
private ColorSelectBox lineColor; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(CustomJsonObject json) { |
||||
JSONObject chartConf = null; |
||||
if (null != json) { |
||||
chartConf = json.get(); |
||||
} |
||||
if (null != chartConf) { |
||||
this.valueY.setValue(chartConf.getDouble("valueY")); |
||||
this.lineColor.setSelectObject(MapUtil.toColor(chartConf.getString("lineColor"))); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public CustomJsonObject updateBean() { |
||||
JSONObject chartConf = JSONObject.create(); |
||||
|
||||
chartConf.put("valueY", this.valueY.getValue()); |
||||
chartConf.put("lineColor", MapUtil.toHex(this.lineColor.getSelectObject())); |
||||
|
||||
BgGridXJson json = new BgGridXJson(); |
||||
chartConf.put("title", json.getTilte()); |
||||
json.put(chartConf); |
||||
|
||||
return json; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-BmwGantt-Cond-condTaskBgTitle"); |
||||
} |
||||
|
||||
protected class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel linePane = createLinePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{linePane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize); |
||||
this.add(panel, BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
private JPanel createLinePane() { |
||||
this.valueY = new UISpinner(0, 999999999, 1, 100); |
||||
this.lineColor = new ColorSelectBox(100); |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-showPieValue")), this.valueY}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-lineColor")), this.lineColor} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f}); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,149 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.imenutable.UIMenuNameableCreator; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.plugin.pielinecomb.vo.BgGridXJson; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.stable.ListMap; |
||||
import com.fr.stable.Nameable; |
||||
import com.fr.van.chart.designer.component.VanChartUIListControlPane; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class BgGridCondListPane extends VanChartUIListControlPane { |
||||
|
||||
private PieLineCombChart chart; |
||||
|
||||
private HashMap paneMap; |
||||
private HashMap jsonMap; |
||||
|
||||
public BgGridCondListPane() { |
||||
paneMap = new HashMap(6); |
||||
paneMap.put(CustomJsonObject.BG_GRID_X, BgGridCondCreator.class); |
||||
|
||||
jsonMap = new HashMap(6); |
||||
jsonMap.put(CustomJsonObject.BG_GRID_X, BgGridXJson.class); |
||||
} |
||||
|
||||
@Override |
||||
protected void update(Plot plot) { |
||||
} |
||||
|
||||
public void populateStyle(PieLineCombChart chart) { |
||||
this.chart = chart; |
||||
|
||||
JSONObject styleCond = chart.getStyleCond(); |
||||
if (null != styleCond && null != styleCond.get("grid")) { |
||||
JSONArray chartConf = styleCond.getJSONArray("grid"); |
||||
ArrayList noList = new ArrayList(); |
||||
for (int i = 0; null != chartConf && i < chartConf.size(); i++) { |
||||
JSONObject line = chartConf.getJSONObject(i); |
||||
if (null != line) { |
||||
try { |
||||
CustomJsonObject json = (CustomJsonObject)this.getJsonByTitle(line.getString("title")).newInstance(); |
||||
json.put(line); |
||||
UIMenuNameableCreator var11 = new UIMenuNameableCreator(line.getString("titleName"), json, this.getEditPaneByTitle(line.getString("title"))); |
||||
noList.add(new NameObject(var11.getName(), var11.getObj())); |
||||
} catch (InstantiationException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
this.populate((Nameable[])noList.toArray(new NameObject[noList.size()])); |
||||
this.doLayout(); |
||||
} |
||||
|
||||
} |
||||
|
||||
public void updateStyle(PieLineCombChart chart) { |
||||
Nameable[] nameables = this.update(); |
||||
|
||||
JSONArray objConf = JSONArray.create(); |
||||
for (int i = 0; i < nameables.length; i++) { |
||||
CustomJsonObject noObj = (CustomJsonObject)((NameObject)nameables[i]).getObject(); |
||||
if (null == noObj) { |
||||
noObj = new CustomJsonObject(); |
||||
noObj.put(JSONObject.create()); |
||||
} |
||||
if (null == noObj.get()) { |
||||
noObj.put(JSONObject.create()); |
||||
} |
||||
|
||||
noObj.get().put("titleName", ((NameObject)nameables[i]).getName()); |
||||
objConf.add(noObj.get()); |
||||
} |
||||
|
||||
if (null == chart.getStyleCond()) { |
||||
chart.setStyleCond(JSONObject.create()); |
||||
} |
||||
chart.getStyleCond().put("grid", objConf); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
ListMap creatorMap = new ListMap(); |
||||
|
||||
NameableCreator grid = new NameObjectCreator(Toolkit.i18nText("Plugin-Pielinecomb-bgGridX"), BgGridXJson.class, BgGridCondCreator.class); |
||||
creatorMap.put(grid.menuName(), grid); |
||||
|
||||
return (NameableCreator[])creatorMap.values().toArray(new NameableCreator[creatorMap.size()]); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion"); |
||||
} |
||||
|
||||
@Override |
||||
protected String getAddItemText() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-Cond-CustomGrid"); |
||||
} |
||||
|
||||
@Override |
||||
public BasicBeanPane createPaneByCreators(NameableCreator nameableCreator) { |
||||
Constructor var2 = null; |
||||
try { |
||||
var2 = nameableCreator.getUpdatePane().getConstructor(); |
||||
return (BasicBeanPane)var2.newInstance(); |
||||
} catch (InstantiationException var4) { |
||||
FineLoggerFactory.getLogger().error(var4.getMessage(), var4); |
||||
} catch (IllegalAccessException var5) { |
||||
FineLoggerFactory.getLogger().error(var5.getMessage(), var5); |
||||
} catch (NoSuchMethodException var6) { |
||||
return super.createPaneByCreators(nameableCreator); |
||||
} catch (InvocationTargetException var7) { |
||||
FineLoggerFactory.getLogger().error(var7.getMessage(), var7); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
private Class<? extends BasicBeanPane> getEditPaneByTitle(String title) { |
||||
return (Class)paneMap.get(title); |
||||
} |
||||
|
||||
private Class getJsonByTitle(String title) { |
||||
return (Class)jsonMap.get(title); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,161 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.imenutable.UIMenuNameableCreator; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.plugin.pielinecomb.vo.ItemColorJson; |
||||
import com.fr.plugin.pielinecomb.vo.ItemLabelJson; |
||||
import com.fr.plugin.pielinecomb.vo.ItemTipsJson; |
||||
import com.fr.stable.ListMap; |
||||
import com.fr.stable.Nameable; |
||||
import com.fr.van.chart.designer.component.VanChartUIListControlPane; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class LineCondListPane extends VanChartUIListControlPane { |
||||
|
||||
private PieLineCombChart chart; |
||||
|
||||
private HashMap paneMap; |
||||
private HashMap jsonMap; |
||||
|
||||
public LineCondListPane() { |
||||
paneMap = new HashMap(6); |
||||
paneMap.put(CustomJsonObject.ITEM_COLOR, PieLineCombColorCondCreator.class); |
||||
paneMap.put(CustomJsonObject.ITEM_LABEL, LineLabelCondCreator.class); |
||||
paneMap.put(CustomJsonObject.ITEM_TIPS, PieLineCombTipsCondCreator.class); |
||||
|
||||
jsonMap = new HashMap(6); |
||||
jsonMap.put(CustomJsonObject.ITEM_COLOR, ItemColorJson.class); |
||||
jsonMap.put(CustomJsonObject.ITEM_LABEL, ItemLabelJson.class); |
||||
jsonMap.put(CustomJsonObject.ITEM_TIPS, ItemTipsJson.class); |
||||
} |
||||
|
||||
@Override |
||||
protected void update(Plot plot) { |
||||
} |
||||
|
||||
public void populateStyle(PieLineCombChart chart) { |
||||
this.chart = chart; |
||||
|
||||
JSONObject styleCond = chart.getStyleCond(); |
||||
if (null != styleCond && null != styleCond.get("line")) { |
||||
JSONArray chartConf = styleCond.getJSONArray("line"); |
||||
ArrayList noList = new ArrayList(); |
||||
for (int i = 0; null != chartConf && i < chartConf.size(); i++) { |
||||
JSONObject line = chartConf.getJSONObject(i); |
||||
if (null != line) { |
||||
try { |
||||
CustomJsonObject json = (CustomJsonObject)this.getJsonByTitle(line.getString("title")).newInstance(); |
||||
json.put(line); |
||||
UIMenuNameableCreator var11 = new UIMenuNameableCreator(line.getString("titleName"), json, this.getEditPaneByTitle(line.getString("title"))); |
||||
noList.add(new NameObject(var11.getName(), var11.getObj())); |
||||
} catch (InstantiationException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
this.populate((Nameable[])noList.toArray(new NameObject[noList.size()])); |
||||
this.doLayout(); |
||||
} |
||||
|
||||
} |
||||
|
||||
public void updateStyle(PieLineCombChart chart) { |
||||
Nameable[] nameables = this.update(); |
||||
|
||||
JSONArray objConf = JSONArray.create(); |
||||
for (int i = 0; i < nameables.length; i++) { |
||||
CustomJsonObject noObj = (CustomJsonObject)((NameObject)nameables[i]).getObject(); |
||||
if (null == noObj) { |
||||
noObj = new CustomJsonObject(); |
||||
noObj.put(JSONObject.create()); |
||||
} |
||||
if (null == noObj.get()) { |
||||
noObj.put(JSONObject.create()); |
||||
} |
||||
|
||||
noObj.get().put("titleName", ((NameObject)nameables[i]).getName()); |
||||
objConf.add(noObj.get()); |
||||
} |
||||
|
||||
if (null == chart.getStyleCond()) { |
||||
chart.setStyleCond(JSONObject.create()); |
||||
} |
||||
chart.getStyleCond().put("line", objConf); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
ListMap creatorMap = new ListMap(); |
||||
|
||||
NameableCreator color = new NameObjectCreator(Toolkit.i18nText("Plugin-Pielinecomb-color"), ItemColorJson.class, PieLineCombColorCondCreator.class); |
||||
creatorMap.put(color.menuName(), color); |
||||
|
||||
NameableCreator label = new NameObjectCreator(Toolkit.i18nText("Plugin-Pielinecomb-StyleLegendLabel"), ItemLabelJson.class, LineLabelCondCreator.class); |
||||
creatorMap.put(label.menuName(), label); |
||||
|
||||
NameableCreator tips = new NameObjectCreator(Toolkit.i18nText("Plugin-Pielinecomb-StyleLegendTips"), ItemTipsJson.class, PieLineCombTipsCondCreator.class); |
||||
creatorMap.put(tips.menuName(), tips); |
||||
|
||||
return (NameableCreator[])creatorMap.values().toArray(new NameableCreator[creatorMap.size()]); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion"); |
||||
} |
||||
|
||||
@Override |
||||
protected String getAddItemText() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion"); |
||||
} |
||||
|
||||
@Override |
||||
public BasicBeanPane createPaneByCreators(NameableCreator nameableCreator) { |
||||
Constructor var2 = null; |
||||
try { |
||||
var2 = nameableCreator.getUpdatePane().getConstructor(); |
||||
return (BasicBeanPane)var2.newInstance(); |
||||
} catch (InstantiationException var4) { |
||||
FineLoggerFactory.getLogger().error(var4.getMessage(), var4); |
||||
} catch (IllegalAccessException var5) { |
||||
FineLoggerFactory.getLogger().error(var5.getMessage(), var5); |
||||
} catch (NoSuchMethodException var6) { |
||||
return super.createPaneByCreators(nameableCreator); |
||||
} catch (InvocationTargetException var7) { |
||||
FineLoggerFactory.getLogger().error(var7.getMessage(), var7); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
private Class<? extends BasicBeanPane> getEditPaneByTitle(String title) { |
||||
return (Class)paneMap.get(title); |
||||
} |
||||
|
||||
private Class getJsonByTitle(String title) { |
||||
return (Class)jsonMap.get(title); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,148 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.plugin.pielinecomb.vo.ItemLabelJson; |
||||
import com.fr.van.chart.designer.AbstractVanChartScrollPane; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class LineLabelCondCreator extends AbstractVanChartScrollPane<CustomJsonObject> { |
||||
|
||||
private UITextArea condition; |
||||
|
||||
private LineLabelStylePane lineLabelStylePane; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(CustomJsonObject json) { |
||||
JSONObject chartConf = null; |
||||
if (null != json) { |
||||
chartConf = json.get(); |
||||
} |
||||
if (null != chartConf) { |
||||
this.lineLabelStylePane.populateBean(chartConf); |
||||
this.condition.setText(chartConf.getString("condition")); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public CustomJsonObject updateBean() { |
||||
JSONObject chartConf = JSONObject.create(); |
||||
|
||||
chartConf.put("condition", this.condition.getText()); |
||||
|
||||
JSONObject pieLabel = this.lineLabelStylePane.update(); |
||||
chartConf.mergeIn(pieLabel); |
||||
|
||||
ItemLabelJson json = new ItemLabelJson(); |
||||
chartConf.put("title", json.getTilte()); |
||||
json.put(chartConf); |
||||
|
||||
return json; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-BmwGantt-Cond-condTaskBgTitle"); |
||||
} |
||||
|
||||
protected class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel condPane = createConditionPane(); |
||||
JPanel linePane = createLinePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{linePane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize); |
||||
this.add(panel, BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
private JPanel createLinePane() { |
||||
this.lineLabelStylePane = new LineLabelStylePane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleStyle"), this.lineLabelStylePane); |
||||
} |
||||
|
||||
private JPanel createConditionPane() { |
||||
condition = new UITextArea(3, 6); |
||||
final UITextField value = new UITextField(); |
||||
final UIComboBox filed = new UIComboBox(new String[]{"分类名", "系列名", "数值"}); |
||||
final UIComboBox cond = new UIComboBox(new String[]{"==", "!=", ">", ">=", "<", "<="}); |
||||
|
||||
UIButton add = new UIButton(Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion")); |
||||
UIButton clear = new UIButton(Toolkit.i18nText("Plugin-Pielinecomb-Cond-clearButton")); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{filed, cond, value, add, clear} |
||||
}; |
||||
JPanel condPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{p, p, f, p, p}); |
||||
|
||||
Component[][] comp1 = new Component[][]{ |
||||
new Component[]{condition} |
||||
}; |
||||
JPanel areaPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, new double[]{p}, new double[]{f}); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{areaPane} |
||||
}; |
||||
JPanel sumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
|
||||
condition.setEnabled(false); |
||||
add.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
String srcStr = condition.getText(); |
||||
if (null != srcStr && !"".equals(srcStr)) { |
||||
srcStr += " && "; |
||||
} |
||||
String condstr = "'{" + filed.getSelectedItem() + "}' " + cond.getSelectedItem() + " '" + value.getText() + "'"; |
||||
condition.setText(srcStr + condstr); |
||||
} |
||||
}); |
||||
clear.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
condition.setText(""); |
||||
} |
||||
}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-condition"), sumPane); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,202 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.chart.base.TextAttr; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/22 |
||||
*/ |
||||
public class LineLabelStylePane extends JPanel { |
||||
private UIButtonGroup<Integer> lineValueType; |
||||
private CardLayout lineCardLayout; |
||||
private JPanel lineCardPane; |
||||
|
||||
private UICheckBox showLineLabel; |
||||
private UICheckBox showLineCategory; |
||||
private UICheckBox showLineSeries; |
||||
private UICheckBox showLineValue; |
||||
private UITextArea lineJsPane; |
||||
private ChartTextAttrPane lineTextAttrPane; |
||||
|
||||
private UIButtonGroup<String> linePosition; |
||||
|
||||
|
||||
public LineLabelStylePane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
public void populateBean(JSONObject chartConf) { |
||||
this.showLineLabel.setSelected(chartConf.getBoolean("showLineLabel")); |
||||
this.lineValueType.setSelectedItem(chartConf.getInt("lineValueType")); |
||||
this.showLineCategory.setSelected(chartConf.getBoolean("showLineCategory")); |
||||
this.showLineSeries.setSelected(chartConf.getBoolean("showLineSeries")); |
||||
this.showLineValue.setSelected(chartConf.getBoolean("showLineValue")); |
||||
this.lineJsPane.setText(chartConf.getString("lineJsPane")); |
||||
this.linePosition.setSelectedItem(chartConf.getString("linePosition")); |
||||
|
||||
FRFont textFont = FRFont.getInstance(chartConf.getString("linelabelfamily"), |
||||
chartConf.getInt("linelabelstyle"), |
||||
chartConf.getInt("linelabelsize"), |
||||
MapUtil.toColor(chartConf.getString("linelabelcolor"))); |
||||
this.lineTextAttrPane.populate(textFont); |
||||
|
||||
if (chartConf.getInt("lineValueType") == 2) { |
||||
this.lineCardLayout.show(this.lineCardPane, "linejs"); |
||||
} else { |
||||
this.lineCardLayout.show(this.lineCardPane, "linecheck"); |
||||
} |
||||
} |
||||
|
||||
public JSONObject update() { |
||||
JSONObject chartConf = JSONObject.create(); |
||||
chartConf.put("showLineLabel", this.showLineLabel.isSelected()); |
||||
chartConf.put("lineValueType", this.lineValueType.getSelectedItem()); |
||||
chartConf.put("showLineCategory", this.showLineCategory.isSelected()); |
||||
chartConf.put("showLineSeries", this.showLineSeries.isSelected()); |
||||
chartConf.put("showLineValue", this.showLineValue.isSelected()); |
||||
chartConf.put("lineJsPane", this.lineJsPane.getText()); |
||||
chartConf.put("linePosition", this.linePosition.getSelectedItem()); |
||||
|
||||
TextAttr textAttr = this.lineTextAttrPane.update(); |
||||
chartConf.put("linelabelsize", textAttr.getFRFont().getSize()); |
||||
chartConf.put("linelabelstyle", textAttr.getFRFont().getStyle()); |
||||
chartConf.put("linelabelfamily", textAttr.getFRFont().getFamily()); |
||||
chartConf.put("linelabelcolor", MapUtil.toHex(textAttr.getFRFont().getForeground())); |
||||
|
||||
return chartConf; |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel mainPane = createLineLabelPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{mainPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
|
||||
private JPanel createLineLabelPane() { |
||||
lineValueType = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-general"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-custom") |
||||
}, |
||||
new Integer[]{1, 2} |
||||
); |
||||
lineValueType.setSelectedItem(1); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null}, |
||||
new Component[]{this.lineValueType} |
||||
}; |
||||
JPanel lineValueTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
|
||||
|
||||
showLineLabel = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-showPieLabel")); |
||||
|
||||
showLineCategory = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-showPieCategory")); |
||||
showLineSeries = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-showPieSeries")); |
||||
showLineValue = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-showPieValue")); |
||||
|
||||
Component[][] compCheck = new Component[][]{ |
||||
new Component[]{showLineCategory}, |
||||
new Component[]{showLineSeries}, |
||||
new Component[]{showLineValue} |
||||
}; |
||||
final JPanel checkPane = TableLayout4VanChartHelper.createGapTableLayoutPane(compCheck, new double[]{p, p, p, p}, new double[]{f}); |
||||
|
||||
lineJsPane = new UITextArea(6, 6); |
||||
|
||||
lineCardPane = new JPanel(this.lineCardLayout = new CardLayout()){ |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if (null != lineValueType.getSelectedItem() && lineValueType.getSelectedItem() == 2) { |
||||
return lineJsPane.getPreferredSize(); |
||||
} else { |
||||
return checkPane.getPreferredSize(); |
||||
} |
||||
} |
||||
}; |
||||
lineCardPane.add(checkPane, "linecheck"); |
||||
lineCardPane.add(lineJsPane, "linejs"); |
||||
this.lineCardLayout.show(lineCardPane, "linecheck"); |
||||
lineValueType.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent var1x) { |
||||
if (lineValueType.getSelectedItem() == 1) { |
||||
lineCardLayout.show(lineCardPane, "linecheck"); |
||||
} else { |
||||
lineCardLayout.show(lineCardPane, "linejs"); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
Component[][] contentComp = new Component[][]{ |
||||
new Component[]{lineValueTypePane}, |
||||
new Component[]{lineCardPane} |
||||
}; |
||||
JPanel contentCompPane = TableLayout4VanChartHelper.createGapTableLayoutPane(contentComp, new double[]{p, p, p}, new double[]{f}); |
||||
JPanel contentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleText"), contentCompPane); |
||||
|
||||
JPanel stylePane = createLineTextPane(); |
||||
|
||||
JPanel layoutPane = createLinePosition(); |
||||
|
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{showLineLabel}, |
||||
new Component[]{contentPane}, |
||||
new Component[]{stylePane}, |
||||
new Component[]{layoutPane} |
||||
}; |
||||
|
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p, p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createLinePosition() { |
||||
this.linePosition = new UIButtonGroup<String>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-postop"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-posbottom") |
||||
}, |
||||
new String[]{"top", "bottom"} |
||||
); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-TitlePosition")), this.linePosition} |
||||
}; |
||||
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{p, f}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-layout"), pane); |
||||
} |
||||
|
||||
private JPanel createLineTextPane() { |
||||
this.lineTextAttrPane = new ChartTextAttrPane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleStyle"), this.lineTextAttrPane); |
||||
} |
||||
} |
@ -0,0 +1,94 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import java.awt.*; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class MapUtil { |
||||
public static String getString(Map map, String key) { |
||||
return getString(map, key, null); |
||||
} |
||||
|
||||
public static String getString(Map map, String key, String def) { |
||||
if (null == map) { |
||||
return def; |
||||
} |
||||
if (null != map.get(key)) { |
||||
return map.get(key).toString(); |
||||
} else { |
||||
return def; |
||||
} |
||||
} |
||||
|
||||
public static Integer getInteger(Map map, String key) { |
||||
return getInteger(map, key, null); |
||||
} |
||||
|
||||
public static Integer getInteger(Map map, String key, Integer def) { |
||||
if (null == map) { |
||||
return def; |
||||
} |
||||
if (null != map.get(key)) { |
||||
return Integer.parseInt(map.get(key).toString()); |
||||
} else { |
||||
return def; |
||||
} |
||||
} |
||||
|
||||
public static Double getDouble(Map map, String key) { |
||||
return getDouble(map, key, null); |
||||
} |
||||
|
||||
public static Double getDouble(Map map, String key, Double def) { |
||||
if (null == map) { |
||||
return def; |
||||
} |
||||
if (null != map.get(key)) { |
||||
return Double.parseDouble(map.get(key).toString()); |
||||
} else { |
||||
return def; |
||||
} |
||||
} |
||||
|
||||
public static Boolean getBoolean(Map map, String key) { |
||||
return getBoolean(map, key, null); |
||||
} |
||||
|
||||
public static Boolean getBoolean(Map map, String key, Boolean def) { |
||||
if (null == map) { |
||||
return def; |
||||
} |
||||
String s = getString(map, key); |
||||
if (null != s) { |
||||
if ("true".equals(s)) { |
||||
return true; |
||||
} else if ("false".equals(s)){ |
||||
return false; |
||||
} else { |
||||
return def; |
||||
} |
||||
} else { |
||||
return def; |
||||
} |
||||
} |
||||
|
||||
public static String toHex(Color c) { |
||||
if (null == c) { |
||||
return "transparent"; |
||||
} |
||||
String hex = Integer.toHexString(c.getRGB()); |
||||
if (hex.length() == 8) { |
||||
hex = "#" + hex.substring(2); |
||||
} |
||||
return hex; |
||||
} |
||||
public static Color toColor(String c) { |
||||
if (null != c && c.startsWith("#")) { |
||||
c = c.substring(1); |
||||
return new Color(Integer.parseInt(c, 16)); |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,161 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.imenutable.UIMenuNameableCreator; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.plugin.pielinecomb.vo.ItemColorJson; |
||||
import com.fr.plugin.pielinecomb.vo.ItemLabelJson; |
||||
import com.fr.plugin.pielinecomb.vo.ItemTipsJson; |
||||
import com.fr.stable.ListMap; |
||||
import com.fr.stable.Nameable; |
||||
import com.fr.van.chart.designer.component.VanChartUIListControlPane; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class PieCondListPane extends VanChartUIListControlPane { |
||||
|
||||
private PieLineCombChart chart; |
||||
|
||||
private HashMap paneMap; |
||||
private HashMap jsonMap; |
||||
|
||||
public PieCondListPane() { |
||||
paneMap = new HashMap(6); |
||||
paneMap.put(CustomJsonObject.ITEM_COLOR, PieLineCombColorCondCreator.class); |
||||
paneMap.put(CustomJsonObject.ITEM_LABEL, PieLabelCondCreator.class); |
||||
paneMap.put(CustomJsonObject.ITEM_TIPS, PieLineCombTipsCondCreator.class); |
||||
|
||||
jsonMap = new HashMap(6); |
||||
jsonMap.put(CustomJsonObject.ITEM_COLOR, ItemColorJson.class); |
||||
jsonMap.put(CustomJsonObject.ITEM_LABEL, ItemLabelJson.class); |
||||
jsonMap.put(CustomJsonObject.ITEM_TIPS, ItemTipsJson.class); |
||||
} |
||||
|
||||
@Override |
||||
protected void update(Plot plot) { |
||||
} |
||||
|
||||
public void populateStyle(PieLineCombChart chart) { |
||||
this.chart = chart; |
||||
|
||||
JSONObject styleCond = chart.getStyleCond(); |
||||
if (null != styleCond && null != styleCond.get("pie")) { |
||||
JSONArray chartConf = styleCond.getJSONArray("pie"); |
||||
ArrayList noList = new ArrayList(); |
||||
for (int i = 0; null != chartConf && i < chartConf.size(); i++) { |
||||
JSONObject line = chartConf.getJSONObject(i); |
||||
if (null != line) { |
||||
try { |
||||
CustomJsonObject json = (CustomJsonObject)this.getJsonByTitle(line.getString("title")).newInstance(); |
||||
json.put(line); |
||||
UIMenuNameableCreator var11 = new UIMenuNameableCreator(line.getString("titleName"), json, this.getEditPaneByTitle(line.getString("title"))); |
||||
noList.add(new NameObject(var11.getName(), var11.getObj())); |
||||
} catch (InstantiationException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
this.populate((Nameable[])noList.toArray(new NameObject[noList.size()])); |
||||
this.doLayout(); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
||||
public void updateStyle(PieLineCombChart chart) { |
||||
Nameable[] nameables = this.update(); |
||||
|
||||
JSONArray objConf = JSONArray.create(); |
||||
for (int i = 0; i < nameables.length; i++) { |
||||
CustomJsonObject noObj = (CustomJsonObject)((NameObject)nameables[i]).getObject(); |
||||
if (null == noObj) { |
||||
noObj = new CustomJsonObject(); |
||||
noObj.put(JSONObject.create()); |
||||
} |
||||
if (null == noObj.get()) { |
||||
noObj.put(JSONObject.create()); |
||||
} |
||||
|
||||
noObj.get().put("titleName", ((NameObject)nameables[i]).getName()); |
||||
objConf.add(noObj.get()); |
||||
} |
||||
|
||||
if (null == chart.getStyleCond()) { |
||||
chart.setStyleCond(JSONObject.create()); |
||||
} |
||||
chart.getStyleCond().put("pie", objConf); |
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
ListMap creatorMap = new ListMap(); |
||||
|
||||
NameableCreator color = new NameObjectCreator(Toolkit.i18nText("Plugin-Pielinecomb-color"), ItemColorJson.class, PieLineCombColorCondCreator.class); |
||||
creatorMap.put(color.menuName(), color); |
||||
|
||||
NameableCreator label = new NameObjectCreator(Toolkit.i18nText("Plugin-Pielinecomb-StyleLegendLabel"), ItemLabelJson.class, PieLabelCondCreator.class); |
||||
creatorMap.put(label.menuName(), label); |
||||
|
||||
NameableCreator tips = new NameObjectCreator(Toolkit.i18nText("Plugin-Pielinecomb-StyleLegendTips"), ItemTipsJson.class, PieLineCombTipsCondCreator.class); |
||||
creatorMap.put(tips.menuName(), tips); |
||||
|
||||
return (NameableCreator[])creatorMap.values().toArray(new NameableCreator[creatorMap.size()]); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion"); |
||||
} |
||||
|
||||
@Override |
||||
protected String getAddItemText() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion"); |
||||
} |
||||
|
||||
@Override |
||||
public BasicBeanPane createPaneByCreators(NameableCreator nameableCreator) { |
||||
Constructor var2 = null; |
||||
try { |
||||
var2 = nameableCreator.getUpdatePane().getConstructor(); |
||||
return (BasicBeanPane)var2.newInstance(); |
||||
} catch (InstantiationException var4) { |
||||
FineLoggerFactory.getLogger().error(var4.getMessage(), var4); |
||||
} catch (IllegalAccessException var5) { |
||||
FineLoggerFactory.getLogger().error(var5.getMessage(), var5); |
||||
} catch (NoSuchMethodException var6) { |
||||
return super.createPaneByCreators(nameableCreator); |
||||
} catch (InvocationTargetException var7) { |
||||
FineLoggerFactory.getLogger().error(var7.getMessage(), var7); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
private Class<? extends BasicBeanPane> getEditPaneByTitle(String title) { |
||||
return (Class)paneMap.get(title); |
||||
} |
||||
|
||||
private Class getJsonByTitle(String title) { |
||||
return (Class)jsonMap.get(title); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,148 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.plugin.pielinecomb.vo.ItemLabelJson; |
||||
import com.fr.van.chart.designer.AbstractVanChartScrollPane; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class PieLabelCondCreator extends AbstractVanChartScrollPane<CustomJsonObject> { |
||||
|
||||
private UITextArea condition; |
||||
|
||||
private PieLabelStylePane pieLabelStylePane; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(CustomJsonObject json) { |
||||
JSONObject chartConf = null; |
||||
if (null != json) { |
||||
chartConf = json.get(); |
||||
} |
||||
if (null != chartConf) { |
||||
this.pieLabelStylePane.populateBean(chartConf); |
||||
this.condition.setText(chartConf.getString("condition")); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public CustomJsonObject updateBean() { |
||||
JSONObject chartConf = JSONObject.create(); |
||||
|
||||
chartConf.put("condition", this.condition.getText()); |
||||
|
||||
JSONObject pieLabel = this.pieLabelStylePane.update(); |
||||
chartConf.mergeIn(pieLabel); |
||||
|
||||
ItemLabelJson json = new ItemLabelJson(); |
||||
chartConf.put("title", json.getTilte()); |
||||
json.put(chartConf); |
||||
|
||||
return json; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-BmwGantt-Cond-condTaskBgTitle"); |
||||
} |
||||
|
||||
protected class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel condPane = createConditionPane(); |
||||
JPanel linePane = createLinePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{linePane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize); |
||||
this.add(panel, BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
private JPanel createLinePane() { |
||||
this.pieLabelStylePane = new PieLabelStylePane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleStyle"), this.pieLabelStylePane); |
||||
} |
||||
|
||||
private JPanel createConditionPane() { |
||||
condition = new UITextArea(3, 6); |
||||
final UITextField value = new UITextField(); |
||||
final UIComboBox filed = new UIComboBox(new String[]{"分类名", "系列名", "数值"}); |
||||
final UIComboBox cond = new UIComboBox(new String[]{"==", "!=", ">", ">=", "<", "<="}); |
||||
|
||||
UIButton add = new UIButton(Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion")); |
||||
UIButton clear = new UIButton(Toolkit.i18nText("Plugin-Pielinecomb-Cond-clearButton")); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{filed, cond, value, add, clear} |
||||
}; |
||||
JPanel condPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{p, p, f, p, p}); |
||||
|
||||
Component[][] comp1 = new Component[][]{ |
||||
new Component[]{condition} |
||||
}; |
||||
JPanel areaPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, new double[]{p}, new double[]{f}); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{areaPane} |
||||
}; |
||||
JPanel sumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
|
||||
condition.setEnabled(false); |
||||
add.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
String srcStr = condition.getText(); |
||||
if (null != srcStr && !"".equals(srcStr)) { |
||||
srcStr += " && "; |
||||
} |
||||
String condstr = "'{" + filed.getSelectedItem() + "}' " + cond.getSelectedItem() + " '" + value.getText() + "'"; |
||||
condition.setText(srcStr + condstr); |
||||
} |
||||
}); |
||||
clear.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
condition.setText(""); |
||||
} |
||||
}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-condition"), sumPane); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,215 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.chart.base.TextAttr; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/22 |
||||
*/ |
||||
public class PieLabelStylePane extends JPanel { |
||||
|
||||
private UIButtonGroup<Integer> pieValueType; |
||||
private CardLayout pieCardLayout; |
||||
private JPanel pieCardPane; |
||||
|
||||
private UICheckBox showPieLabel; |
||||
private UICheckBox showPieCategory; |
||||
private UICheckBox showPieSeries; |
||||
private UICheckBox showPieValue; |
||||
private UITextArea pieJsPane; |
||||
private ChartTextAttrPane pieTextAttrPane; |
||||
|
||||
private UIButtonGroup<String> piePosition; |
||||
private UIButtonGroup<Integer> pieDirection; |
||||
|
||||
|
||||
public PieLabelStylePane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
public void populateBean(JSONObject chartConf) { |
||||
this.showPieLabel.setSelected(chartConf.getBoolean("showPieLabel")); |
||||
this.pieValueType.setSelectedItem(chartConf.getInt("pieValueType")); |
||||
this.showPieCategory.setSelected(chartConf.getBoolean("showPieCategory")); |
||||
this.showPieSeries.setSelected(chartConf.getBoolean("showPieSeries")); |
||||
this.showPieValue.setSelected(chartConf.getBoolean("showPieValue")); |
||||
this.pieJsPane.setText(chartConf.getString("pieJsPane")); |
||||
this.piePosition.setSelectedItem(chartConf.getString("piePosition")); |
||||
this.pieDirection.setSelectedItem(chartConf.getInt("pieDirection")); |
||||
|
||||
FRFont textFont = FRFont.getInstance(chartConf.getString("pielabelfamily"), |
||||
chartConf.getInt("pielabelstyle"), |
||||
chartConf.getInt("pielabelsize"), |
||||
MapUtil.toColor(chartConf.getString("pielabelcolor"))); |
||||
this.pieTextAttrPane.populate(textFont); |
||||
|
||||
if (chartConf.getInt("pieValueType") == 2) { |
||||
this.pieCardLayout.show(this.pieCardPane, "piejs"); |
||||
} else { |
||||
this.pieCardLayout.show(this.pieCardPane, "piecheck"); |
||||
} |
||||
|
||||
} |
||||
|
||||
public JSONObject update() { |
||||
JSONObject chartConf = JSONObject.create(); |
||||
chartConf.put("showPieLabel", this.showPieLabel.isSelected()); |
||||
chartConf.put("pieValueType", this.pieValueType.getSelectedItem()); |
||||
chartConf.put("showPieCategory", this.showPieCategory.isSelected()); |
||||
chartConf.put("showPieSeries", this.showPieSeries.isSelected()); |
||||
chartConf.put("showPieValue", this.showPieValue.isSelected()); |
||||
chartConf.put("pieJsPane", this.pieJsPane.getText()); |
||||
chartConf.put("piePosition", this.piePosition.getSelectedItem()); |
||||
chartConf.put("pieDirection", this.pieDirection.getSelectedItem()); |
||||
|
||||
TextAttr textAttr = this.pieTextAttrPane.update(); |
||||
chartConf.put("pielabelsize", textAttr.getFRFont().getSize()); |
||||
chartConf.put("pielabelstyle", textAttr.getFRFont().getStyle()); |
||||
chartConf.put("pielabelfamily", textAttr.getFRFont().getFamily()); |
||||
chartConf.put("pielabelcolor", MapUtil.toHex(textAttr.getFRFont().getForeground())); |
||||
return chartConf; |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel mainPane = createPieLabelPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{mainPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
|
||||
private JPanel createPieLabelPane() { |
||||
pieValueType = new UIButtonGroup<Integer>(new String[]{ |
||||
com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-general"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-custom") |
||||
}, |
||||
new Integer[]{1, 2} |
||||
); |
||||
pieValueType.setSelectedItem(1); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null}, |
||||
new Component[]{this.pieValueType} |
||||
}; |
||||
JPanel pieValueTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
|
||||
|
||||
showPieLabel = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-showPieLabel")); |
||||
|
||||
showPieCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-showPieCategory")); |
||||
showPieSeries = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-showPieSeries")); |
||||
showPieValue = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-showPieValue")); |
||||
|
||||
Component[][] compCheck = new Component[][]{ |
||||
new Component[]{showPieCategory}, |
||||
new Component[]{showPieSeries}, |
||||
new Component[]{showPieValue} |
||||
}; |
||||
final JPanel checkPane = TableLayout4VanChartHelper.createGapTableLayoutPane(compCheck, new double[]{p, p, p, p}, new double[]{f}); |
||||
|
||||
pieJsPane = new UITextArea(6, 6); |
||||
|
||||
pieCardPane = new JPanel(this.pieCardLayout = new CardLayout()){ |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if (null != pieValueType.getSelectedItem() && pieValueType.getSelectedItem() == 2) { |
||||
return pieJsPane.getPreferredSize(); |
||||
} else { |
||||
return checkPane.getPreferredSize(); |
||||
} |
||||
} |
||||
}; |
||||
pieCardPane.add(checkPane, "piecheck"); |
||||
pieCardPane.add(pieJsPane, "piejs"); |
||||
this.pieCardLayout.show(pieCardPane, "piecheck"); |
||||
pieValueType.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent var1x) { |
||||
CardLayout card = (CardLayout)pieCardPane.getLayout(); |
||||
if (pieValueType.getSelectedItem() == 1) { |
||||
card.show(pieCardPane, "piecheck"); |
||||
} else { |
||||
card.show(pieCardPane, "piejs"); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
Component[][] contentComp = new Component[][]{ |
||||
new Component[]{pieValueTypePane}, |
||||
new Component[]{pieCardPane} |
||||
}; |
||||
JPanel contentCompPane = TableLayout4VanChartHelper.createGapTableLayoutPane(contentComp, new double[]{p, p, p}, new double[]{f}); |
||||
JPanel contentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleText"), contentCompPane); |
||||
|
||||
JPanel stylePane = createPieTextPane(); |
||||
|
||||
JPanel layoutPane = createPiePosition(); |
||||
|
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{showPieLabel}, |
||||
new Component[]{contentPane}, |
||||
new Component[]{stylePane}, |
||||
new Component[]{layoutPane} |
||||
}; |
||||
|
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p, p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createPiePosition() { |
||||
this.piePosition = new UIButtonGroup<String>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-posoutside"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-posinside"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-poscenter") |
||||
}, |
||||
new String[]{"top", "insideTop", "inside"} |
||||
); |
||||
this.pieDirection = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-DirectOrientation"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-DirectVertical") |
||||
}, |
||||
new Integer[]{0, 90} |
||||
); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-TitlePosition")), this.piePosition}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-textDirection")), this.pieDirection} |
||||
}; |
||||
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p}, new double[]{p, f}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-layout"), pane); |
||||
} |
||||
|
||||
private JPanel createPieTextPane() { |
||||
this.pieTextAttrPane = new ChartTextAttrPane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleStyle"), this.pieTextAttrPane); |
||||
} |
||||
} |
@ -0,0 +1,158 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.plugin.pielinecomb.vo.ItemColorJson; |
||||
import com.fr.van.chart.designer.AbstractVanChartScrollPane; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class PieLineCombColorCondCreator extends AbstractVanChartScrollPane<CustomJsonObject> { |
||||
|
||||
private UITextArea condition; |
||||
|
||||
private ColorSelectBox itemcolor; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(CustomJsonObject json) { |
||||
JSONObject chartConf = null; |
||||
if (null != json) { |
||||
chartConf = json.get(); |
||||
} |
||||
if (null != chartConf) { |
||||
this.itemcolor.setSelectObject(MapUtil.toColor(chartConf.getString("itemcolor", "#ffffff"))); |
||||
this.condition.setText(chartConf.getString("condition")); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public CustomJsonObject updateBean() { |
||||
JSONObject chartConf = JSONObject.create(); |
||||
|
||||
chartConf.put("itemcolor", MapUtil.toHex(this.itemcolor.getSelectObject())); |
||||
chartConf.put("condition", this.condition.getText()); |
||||
|
||||
ItemColorJson json = new ItemColorJson(); |
||||
chartConf.put("title", json.getTilte()); |
||||
|
||||
json.put(chartConf); |
||||
return json; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-condition"); |
||||
} |
||||
|
||||
protected class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel condPane = createConditionPane(); |
||||
JPanel linePane = createLinePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{linePane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize); |
||||
this.add(panel, BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
private JPanel createLinePane() { |
||||
this.itemcolor = new ColorSelectBox(100); |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-color")), this.itemcolor} |
||||
}; |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] columnSize = {TableLayout.PREFERRED, TableLayout.FILL}; |
||||
double[] rowSize = {p, p, p}; |
||||
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleStyle"), panel); |
||||
} |
||||
|
||||
private JPanel createConditionPane() { |
||||
condition = new UITextArea(3, 6); |
||||
final UITextField value = new UITextField(); |
||||
final UIComboBox filed = new UIComboBox(new String[]{"分类名", "系列名", "数值"}); |
||||
final UIComboBox cond = new UIComboBox(new String[]{"==", "!=", ">", ">=", "<", "<="}); |
||||
|
||||
UIButton add = new UIButton(Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion")); |
||||
UIButton clear = new UIButton(Toolkit.i18nText("Plugin-Pielinecomb-Cond-clearButton")); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{filed, cond, value, add, clear} |
||||
}; |
||||
JPanel condPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{p, p, f, p, p}); |
||||
|
||||
Component[][] comp1 = new Component[][]{ |
||||
new Component[]{condition} |
||||
}; |
||||
JPanel areaPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, new double[]{p}, new double[]{f}); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{areaPane} |
||||
}; |
||||
JPanel sumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
|
||||
condition.setEnabled(false); |
||||
add.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
String srcStr = condition.getText(); |
||||
if (null != srcStr && !"".equals(srcStr)) { |
||||
srcStr += " && "; |
||||
} |
||||
String condstr = "'{" + filed.getSelectedItem() + "}' " + cond.getSelectedItem() + " '" + value.getText() + "'"; |
||||
condition.setText(srcStr + condstr); |
||||
} |
||||
}); |
||||
clear.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
condition.setText(""); |
||||
} |
||||
}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-condition"), sumPane); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,60 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.js.NameJavaScriptGroup; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.van.chart.custom.component.VanChartHyperLinkPane; |
||||
|
||||
import java.util.Map; |
||||
|
||||
public class PieLineCombHyperLink extends VanChartHyperLinkPane { |
||||
private PieLineCombChart chart; |
||||
private String chartType; |
||||
|
||||
public PieLineCombHyperLink(String chartType) { |
||||
this.chartType = chartType; |
||||
} |
||||
|
||||
|
||||
public void populateBean(PieLineCombChart paramAbstractECharts) { |
||||
this.chart = paramAbstractECharts; |
||||
populate(paramAbstractECharts.getPlot()); |
||||
} |
||||
|
||||
public void updateBean(PieLineCombChart paramAbstractECharts) { |
||||
update(paramAbstractECharts.getPlot()); |
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
return super.createNameableCreators(); |
||||
} |
||||
|
||||
@Override |
||||
public BasicBeanPane createPaneByCreators(NameableCreator nameableCreator) { |
||||
return super.createPaneByCreators(nameableCreator); |
||||
} |
||||
|
||||
@Override |
||||
protected Map<String, BaseFormula> getHyperLinkEditorMap() { |
||||
return this.chart.getHyperLinkEditorMap(); |
||||
} |
||||
|
||||
@Override |
||||
public void refreshNameableCreator(NameableCreator[] nameableCreators) { |
||||
super.refreshNameableCreator(nameableCreators); |
||||
} |
||||
|
||||
@Override |
||||
protected NameJavaScriptGroup populateHotHyperLink(Plot paramPlot) { |
||||
return this.chart.getLinkConf().getNameJavaScriptGroup(this.chartType); |
||||
} |
||||
|
||||
@Override |
||||
protected void updateHotHyperLink(Plot paramPlot, NameJavaScriptGroup paramNameJavaScriptGroup) { |
||||
this.chart.getLinkConf().setNameJavaScriptGroup(this.chartType, paramNameJavaScriptGroup); |
||||
} |
||||
} |
@ -0,0 +1,193 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.plugin.pielinecomb.vo.ItemColorJson; |
||||
import com.fr.plugin.pielinecomb.vo.ItemLabelJson; |
||||
import com.fr.plugin.pielinecomb.vo.ItemTipsJson; |
||||
import com.fr.van.chart.designer.AbstractVanChartScrollPane; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class PieLineCombLabelCondCreator extends AbstractVanChartScrollPane<CustomJsonObject> { |
||||
|
||||
private UITextArea condition; |
||||
|
||||
private ColorSelectBox bgcolor; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(CustomJsonObject json) { |
||||
JSONObject chartConf = null; |
||||
if (null != json) { |
||||
chartConf = json.get(); |
||||
} |
||||
if (null != chartConf) { |
||||
this.bgcolor.setSelectObject(MapUtil.toColor(chartConf.getString("bgcolor", "#ffffff"))); |
||||
this.condition.setText(chartConf.getString("condition")); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public CustomJsonObject updateBean() { |
||||
JSONObject chartConf = JSONObject.create(); |
||||
|
||||
chartConf.put("bgcolor", MapUtil.toHex(this.bgcolor.getSelectObject())); |
||||
chartConf.put("condition", this.condition.getText()); |
||||
|
||||
CustomJsonObject json = new CustomJsonObject(); |
||||
json.put(chartConf); |
||||
return json; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-BmwGantt-Cond-condTaskBgTitle"); |
||||
} |
||||
|
||||
protected class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel condPane = createConditionPane(); |
||||
JPanel linePane = createLinePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{linePane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize); |
||||
this.add(panel, BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
private JPanel createLinePane() { |
||||
this.bgcolor = new ColorSelectBox(100); |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-BmwGantt-Cond-bgcolor")), this.bgcolor} |
||||
}; |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] columnSize = {TableLayout.PREFERRED, TableLayout.FILL}; |
||||
double[] rowSize = {p, p, p}; |
||||
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(components, rowSize, columnSize); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-BmwGantt-Cond-BgStyleExpand"), panel); |
||||
} |
||||
|
||||
private JPanel createConditionPane() { |
||||
condition = new UITextArea(3, 6); |
||||
final UITextField value = new UITextField(); |
||||
final UIComboBox cond = new UIComboBox(new String[]{"==", "!="}); |
||||
UILabel name = new UILabel(Toolkit.i18nText("Plugin-BmwGantt-Cond-groupNameLabel")); |
||||
UIButton add = new UIButton(Toolkit.i18nText("Plugin-BmwGantt-Cond-addButton")); |
||||
UIButton clear = new UIButton(Toolkit.i18nText("Plugin-BmwGantt-Cond-clearButton")); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{name, cond, value, add, clear} |
||||
}; |
||||
JPanel condPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{p, p, f, p, p}); |
||||
|
||||
Component[][] comp1 = new Component[][]{ |
||||
new Component[]{condition} |
||||
}; |
||||
JPanel areaPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, new double[]{p}, new double[]{f}); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{areaPane} |
||||
}; |
||||
JPanel sumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
|
||||
condition.setEnabled(false); |
||||
add.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
String srcStr = condition.getText(); |
||||
if (null != srcStr && !"".equals(srcStr)) { |
||||
srcStr += " && "; |
||||
} |
||||
String condstr = "'{分组名}' " + cond.getSelectedItem() + " '" + value.getText() + "'"; |
||||
condition.setText(srcStr + condstr); |
||||
} |
||||
}); |
||||
clear.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
condition.setText(""); |
||||
} |
||||
}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-BmwGantt-Cond-condTaskBgTitle"), sumPane); |
||||
} |
||||
|
||||
|
||||
public static class PieLineCombStyleColorCondCreator extends PieLineCombLabelCondCreator { |
||||
|
||||
@Override |
||||
public CustomJsonObject updateBean() { |
||||
ItemColorJson json = new ItemColorJson(); |
||||
CustomJsonObject srcObj = super.updateBean(); |
||||
srcObj.get().put("title", json.getTilte()); |
||||
json.put(srcObj.get()); |
||||
return json; |
||||
} |
||||
} |
||||
|
||||
public static class PieLineCombStyleLabelCondCreator extends PieLineCombLabelCondCreator { |
||||
|
||||
@Override |
||||
public CustomJsonObject updateBean() { |
||||
ItemLabelJson json = new ItemLabelJson(); |
||||
CustomJsonObject srcObj = super.updateBean(); |
||||
srcObj.get().put("title", json.getTilte()); |
||||
json.put(srcObj.get()); |
||||
return json; |
||||
} |
||||
} |
||||
|
||||
public static class PieLineCombStyleTipsCondCreator extends PieLineCombLabelCondCreator { |
||||
|
||||
@Override |
||||
public CustomJsonObject updateBean() { |
||||
ItemTipsJson json = new ItemTipsJson(); |
||||
CustomJsonObject srcObj = super.updateBean(); |
||||
srcObj.get().put("title", json.getTilte()); |
||||
json.put(srcObj.get()); |
||||
return json; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,200 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.plugin.pielinecomb.vo.HyperLinkObject; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
public class PieLineCombStyleAnimalPane extends ExtendedScrollPane<PieLineCombChart> { |
||||
|
||||
private UIButtonGroup<Integer> chartType; |
||||
private JPanel cardPane; |
||||
|
||||
/** |
||||
* 柱形图 |
||||
* */ |
||||
private PieLineCombHyperLink pieHyperLink; |
||||
private PieCondListPane pieStyleCondPane; |
||||
|
||||
|
||||
/** |
||||
* 折线图 |
||||
* */ |
||||
private PieLineCombHyperLink lineHyperLink; |
||||
private LineCondListPane lineStyleCondPane; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(PieLineCombChart chart) { |
||||
|
||||
this.pieHyperLink.populateBean(chart); |
||||
this.lineHyperLink.populateBean(chart); |
||||
|
||||
this.pieStyleCondPane.populateStyle(chart); |
||||
this.lineStyleCondPane.populateStyle(chart); |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = new JSONObject(); |
||||
|
||||
this.pieHyperLink.updateBean(chart); |
||||
this.lineHyperLink.updateBean(chart); |
||||
|
||||
this.pieStyleCondPane.updateStyle(chart); |
||||
this.lineStyleCondPane.updateStyle(chart); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-AnimalTitle"); |
||||
} |
||||
|
||||
private class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel chartTypePane = createChartTypePane(); |
||||
JPanel mainPane = createMainPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{chartTypePane}, |
||||
new Component[]{mainPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p, p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
|
||||
this.setVisible(true); |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
private JPanel createMainPane() { |
||||
JPanel piePane = createPiePane(); |
||||
JPanel linePane = createLinePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
cardPane = new JPanel(new CardLayout()){ |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if (null != chartType.getSelectedItem() && chartType.getSelectedItem() == 2) { |
||||
return linePane.getPreferredSize(); |
||||
} else { |
||||
return piePane.getPreferredSize(); |
||||
} |
||||
} |
||||
}; |
||||
cardPane.add(piePane, "pie"); |
||||
cardPane.add(linePane, "line"); |
||||
((CardLayout)cardPane.getLayout()).show(cardPane, "pie"); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{cardPane} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createLinePane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
JPanel linkPane = createLineLinkPane(); |
||||
JPanel condPane = createLineCondPane(); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{linkPane} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createPiePane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
JPanel linkPane = createPieLinkPane(); |
||||
JPanel condPane = createPieCondPane(); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{linkPane} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createChartTypePane() { |
||||
|
||||
chartType = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typepie"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typeline") |
||||
}, |
||||
new Integer[]{1, 2} |
||||
); |
||||
chartType.setSelectedItem(1); |
||||
|
||||
chartType.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent var1x) { |
||||
CardLayout card = (CardLayout) cardPane.getLayout(); |
||||
if (chartType.getSelectedItem() == 1) { |
||||
card.show(cardPane, "pie"); |
||||
} else { |
||||
card.show(cardPane, "line"); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null}, |
||||
new Component[]{this.chartType} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createPieLinkPane() { |
||||
this.pieHyperLink = new PieLineCombHyperLink(HyperLinkObject.CHART_TYPE_PIE); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-hyperLink"), this.pieHyperLink); |
||||
} |
||||
|
||||
private JPanel createLineLinkPane() { |
||||
this.lineHyperLink = new PieLineCombHyperLink(HyperLinkObject.CHART_TYPE_LINE); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-hyperLink"), this.lineHyperLink); |
||||
} |
||||
|
||||
private JPanel createPieCondPane() { |
||||
this.pieStyleCondPane = new PieCondListPane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-styleCondition"), this.pieStyleCondPane); |
||||
} |
||||
|
||||
private JPanel createLineCondPane() { |
||||
this.lineStyleCondPane = new LineCondListPane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-styleCondition"), this.lineStyleCondPane); |
||||
} |
||||
} |
@ -0,0 +1,163 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.event.GlobalNameListener; |
||||
import com.fr.design.event.GlobalNameObserver; |
||||
import com.fr.design.event.UIObserver; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.plugin.pielinecomb.comp.CustomChartAxisButtonPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.HashMap; |
||||
import java.util.Iterator; |
||||
import java.util.LinkedHashMap; |
||||
import java.util.Map; |
||||
|
||||
public class PieLineCombStyleAxisPane extends ExtendedScrollPane<PieLineCombChart> { |
||||
|
||||
private CustomChartAxisButtonPane axisButtonPane; |
||||
|
||||
private LinkedHashMap<String, JPanel> axisPaneMap = new LinkedHashMap<>();; |
||||
private JPanel axisCardPane; |
||||
|
||||
private PieLineCombStylePane stylePane; |
||||
|
||||
public PieLineCombStyleAxisPane(PieLineCombStylePane stylePane) { |
||||
this.stylePane = stylePane; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = chart.getAxisConf(); |
||||
|
||||
if (null == axisPaneMap) { |
||||
axisPaneMap = new LinkedHashMap<>(); |
||||
} |
||||
|
||||
JSONObject axisX = chartConf.getJSONObject("axisX"); |
||||
PieLineCombStyleAxisXPane axisXPane = new PieLineCombStyleAxisXPane(stylePane); |
||||
axisXPane.populateBean(axisX); |
||||
axisPaneMap.put(axisX.getString("axisName"), axisXPane); |
||||
axisCardPane.add(axisXPane, axisX.getString("axisName")); |
||||
|
||||
JSONArray axisYList = chartConf.getJSONArray("axisY"); |
||||
for (int i = 0; i < axisYList.size(); i++) { |
||||
JSONObject axisY = axisYList.getJSONObject(i); |
||||
PieLineCombStyleAxisYPane axisYPane = new PieLineCombStyleAxisYPane(stylePane); |
||||
axisYPane.populateBean(axisY); |
||||
|
||||
axisPaneMap.put(axisY.getString("axisName"), axisYPane); |
||||
axisCardPane.add(axisYPane, axisY.getString("axisName")); |
||||
} |
||||
|
||||
axisButtonPane.populateBean(chartConf); |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = new JSONObject(); |
||||
|
||||
if (null != axisPaneMap && !axisPaneMap.isEmpty()) { |
||||
Iterator<String> it = axisPaneMap.keySet().iterator(); |
||||
JSONArray axisY = JSONArray.create(); |
||||
while(it.hasNext()) { |
||||
String name = it.next(); |
||||
if (name.startsWith("X")) { |
||||
PieLineCombStyleAxisXPane xPane = (PieLineCombStyleAxisXPane)axisPaneMap.get(name); |
||||
JSONObject axisXTmp = xPane.update(); |
||||
axisXTmp.put("axisName", name); |
||||
chartConf.put("axisX", axisXTmp); |
||||
} else if (name.startsWith("Y")) { |
||||
PieLineCombStyleAxisYPane yPane = (PieLineCombStyleAxisYPane)axisPaneMap.get(name); |
||||
JSONObject axisYTmp = yPane.update(); |
||||
axisYTmp.put("axisName", name); |
||||
axisY.put(axisYTmp); |
||||
} |
||||
} |
||||
chartConf.put("axisY", axisY); |
||||
} |
||||
|
||||
chart.setAxisConf(chartConf); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-StyleAxisTitle"); |
||||
} |
||||
|
||||
private class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel mainPane = createMainPane(); |
||||
JPanel axisPane = createAxisPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{mainPane}, |
||||
new Component[]{axisPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p, p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
|
||||
this.setVisible(true); |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
private JPanel createMainPane() { |
||||
axisButtonPane = new CustomChartAxisButtonPane(this); |
||||
return axisButtonPane; |
||||
} |
||||
|
||||
private JPanel createAxisPane() { |
||||
axisCardPane = new JPanel(new CardLayout()); |
||||
// axisPaneMap = new LinkedHashMap<>();
|
||||
// axisPaneMap.put("X轴", new PieLineCombStyleAxisXPane());
|
||||
// axisPaneMap.put("Y轴", new PieLineCombStyleAxisYPane());
|
||||
// Iterator<String> it = axisPaneMap.keySet().iterator();
|
||||
// while (it.hasNext()) {
|
||||
// String name = it.next();
|
||||
// axisCardPane.add(axisPaneMap.get(name), name);
|
||||
// }
|
||||
((CardLayout)axisCardPane.getLayout()).show(axisCardPane, "X轴"); |
||||
return axisCardPane; |
||||
} |
||||
|
||||
public void addAxisPane(String name) { |
||||
axisPaneMap.put(name, new PieLineCombStyleAxisYPane(stylePane)); |
||||
axisCardPane.add(axisPaneMap.get(name), name); |
||||
} |
||||
|
||||
public void delAxisPane(String name) { |
||||
axisPaneMap.remove(name); |
||||
stylePane.attributeChanged(); |
||||
} |
||||
|
||||
public void changeAxisSelected(String name) { |
||||
((CardLayout)axisCardPane.getLayout()).show(axisCardPane, name); |
||||
} |
||||
} |
@ -0,0 +1,296 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.chart.base.TextAttr; |
||||
import com.fr.design.event.GlobalNameListener; |
||||
import com.fr.design.event.GlobalNameObserver; |
||||
import com.fr.design.event.UIObserver; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.design.gui.frpane.UINumberDragPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.comp.CustomFormatPane; |
||||
import com.fr.plugin.pielinecomb.comp.TextFormat; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
public class PieLineCombStyleAxisXPane extends ExtendedScrollPane<JSONObject> { |
||||
|
||||
private UICheckBox isTitleVisiable; |
||||
private TinyFormulaPane titleName; |
||||
private UIButtonGroup<Integer> titleAlignment; |
||||
private ChartTextAttrPane titleTextAttrPane; |
||||
private UINumberDragPane titleRotation; |
||||
|
||||
private UICheckBox isLabelVisiable; |
||||
private ChartTextAttrPane labelTextAttrPane; |
||||
private UINumberDragPane labelRotation; |
||||
|
||||
private UIButtonGroup<Integer> labelFormatType; |
||||
private CustomFormatPane formatPane; |
||||
private UITextArea labelJsPane; |
||||
|
||||
private PieLineCombStylePane stylePane; |
||||
public PieLineCombStyleAxisXPane(PieLineCombStylePane stylePane) { |
||||
this.stylePane = stylePane; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(JSONObject chartConf) { |
||||
this.isTitleVisiable.setSelected(chartConf.getBoolean("isTitleVisiable")); |
||||
this.titleName.populateBean(chartConf.getString("titleName")); |
||||
this.titleAlignment.setSelectedItem(chartConf.getInt("titleAlignment")); |
||||
|
||||
FRFont textFont = FRFont.getInstance(chartConf.getString("titlefamily"), |
||||
chartConf.getInt("titlestyle"), |
||||
chartConf.getInt("titlesize"), |
||||
MapUtil.toColor(chartConf.getString("titlecolor"))); |
||||
this.titleTextAttrPane.populate(textFont); |
||||
|
||||
this.titleRotation.populateBean(chartConf.getDouble("titleRotation")); |
||||
|
||||
this.isLabelVisiable.setSelected(chartConf.getBoolean("isLabelVisiable")); |
||||
textFont = FRFont.getInstance(chartConf.getString("labelfamily"), |
||||
chartConf.getInt("labelstyle"), |
||||
chartConf.getInt("labelsize"), |
||||
MapUtil.toColor(chartConf.getString("labelcolor"))); |
||||
this.labelTextAttrPane.populate(textFont); |
||||
|
||||
this.labelRotation.populateBean(chartConf.getDouble("labelRotation")); |
||||
|
||||
this.labelFormatType.setSelectedItem(chartConf.getInt("labelFormatType")); |
||||
TextFormat format = new TextFormat(); |
||||
format.setType(chartConf.getInt("xformattype")); |
||||
format.setFormatStr(chartConf.getString("xformatstr")); |
||||
this.formatPane.populateBean(format); |
||||
this.labelJsPane.setText(chartConf.getString("labelJsPane")); |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(JSONObject jsonObject) { |
||||
} |
||||
|
||||
public JSONObject update() { |
||||
JSONObject chartConf = new JSONObject(); |
||||
chartConf.put("isTitleVisiable", isTitleVisiable.isSelected()); |
||||
chartConf.put("titleName", titleName.updateBean()); |
||||
chartConf.put("titleAlignment", titleAlignment.getSelectedItem()); |
||||
|
||||
TextAttr textAttr = this.titleTextAttrPane.update(); |
||||
chartConf.put("titlesize", textAttr.getFRFont().getSize()); |
||||
chartConf.put("titlestyle", textAttr.getFRFont().getStyle()); |
||||
chartConf.put("titlefamily", textAttr.getFRFont().getFamily()); |
||||
chartConf.put("titlecolor", MapUtil.toHex(textAttr.getFRFont().getForeground())); |
||||
|
||||
chartConf.put("titleRotation", titleRotation.updateBean()); |
||||
|
||||
chartConf.put("isLabelVisiable", isLabelVisiable.isSelected()); |
||||
textAttr = this.labelTextAttrPane.update(); |
||||
chartConf.put("labelsize", textAttr.getFRFont().getSize()); |
||||
chartConf.put("labelstyle", textAttr.getFRFont().getStyle()); |
||||
chartConf.put("labelfamily", textAttr.getFRFont().getFamily()); |
||||
chartConf.put("labelcolor", MapUtil.toHex(textAttr.getFRFont().getForeground())); |
||||
|
||||
chartConf.put("labelRotation", labelRotation.updateBean()); |
||||
|
||||
chartConf.put("labelFormatType", labelFormatType.getSelectedItem()); |
||||
TextFormat format = formatPane.updateBean(); |
||||
chartConf.put("xformatstr", format.getFormatStr()); |
||||
chartConf.put("xformattype", format.getType()); |
||||
chartConf.put("labelJsPane", labelJsPane.getText()); |
||||
|
||||
return chartConf; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-StyleAxisXTitle"); |
||||
} |
||||
|
||||
private class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
initListener(this); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel titlePane = createTitlePane(); |
||||
JPanel labelPane = createLabelPane(); |
||||
JPanel formatPane = createLabelFormatPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{titlePane}, |
||||
new Component[]{labelPane}, |
||||
new Component[]{formatPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p, p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
|
||||
this.setVisible(true); |
||||
|
||||
} |
||||
|
||||
public void initListener(Container var1) { |
||||
for(int var2 = 0; var2 < var1.getComponentCount(); ++var2) { |
||||
Component var3 = var1.getComponent(var2); |
||||
if (var3 instanceof Container) { |
||||
this.initListener((Container)var3); |
||||
} |
||||
|
||||
if (var3 instanceof UIObserver) { |
||||
((UIObserver)var3).registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
PieLineCombStyleAxisXPane.this.stylePane.attributeChanged(); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
private JPanel createTitlePane() { |
||||
isTitleVisiable = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-isVisiableTitle")); |
||||
titleName = new TinyFormulaPane(); |
||||
|
||||
Icon[] titlePositonIcons = new Icon[]{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; |
||||
Integer[] titlePositionVal = new Integer[]{2, 0, 4}; |
||||
this.titleAlignment = new UIButtonGroup(titlePositonIcons, titlePositionVal); |
||||
|
||||
titleRotation = new UINumberDragPane(-90, 90); |
||||
|
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-TitleText")), this.titleName}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-TitlePosition")), this.titleAlignment}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-textRotation")), this.titleRotation} |
||||
}; |
||||
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p, p, p}, new double[]{p, f}); |
||||
|
||||
|
||||
titleTextAttrPane = new ChartTextAttrPane(); |
||||
|
||||
Component[][] sumComp = new Component[][]{ |
||||
new Component[]{isTitleVisiable}, |
||||
new Component[]{panel}, |
||||
new Component[]{titleTextAttrPane} |
||||
}; |
||||
JPanel sumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(sumComp, new double[]{p, p, p}, new double[]{f}); |
||||
|
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleNameExpand"), sumPane); |
||||
|
||||
} |
||||
|
||||
private JPanel createLabelPane() { |
||||
isLabelVisiable = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-isLabelVisiable")); |
||||
labelTextAttrPane = new ChartTextAttrPane(); |
||||
labelRotation = new UINumberDragPane(-90, 90); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-textRotation")), this.labelRotation} |
||||
}; |
||||
JPanel rotatePane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p}, new double[]{p, f}); |
||||
|
||||
Component[][] sumComp = new Component[][]{ |
||||
new Component[]{isLabelVisiable}, |
||||
new Component[]{labelTextAttrPane}, |
||||
new Component[]{rotatePane} |
||||
}; |
||||
JPanel sumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(sumComp, new double[]{p, p, p}, new double[]{f}); |
||||
|
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-axisLabelTitle"), sumPane); |
||||
|
||||
} |
||||
|
||||
private JPanel createLabelFormatPane() { |
||||
labelFormatType = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-general"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-custom") |
||||
}, new Integer[]{1, 2}); |
||||
|
||||
labelFormatType.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
checkFormatType(); |
||||
} |
||||
}); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-labelFormatType")), this.labelFormatType} |
||||
}; |
||||
JPanel typePane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p}, new double[]{p, f}); |
||||
|
||||
|
||||
formatPane = new CustomFormatPane() { |
||||
@Override |
||||
protected Component[][] getComponent(JPanel var1, JPanel var2, JPanel var3) { |
||||
var3.setBorder(BorderFactory.createEmptyBorder()); |
||||
return new Component[][]{{var3, null}, {var2, null}}; |
||||
} |
||||
}; |
||||
|
||||
labelJsPane = new UITextArea(6, 6); |
||||
|
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
contentPane.add(formatPane, BorderLayout.NORTH); |
||||
contentPane.add(labelJsPane, BorderLayout.CENTER); |
||||
|
||||
labelJsPane.setVisible(false); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{typePane}, |
||||
new Component[]{contentPane} |
||||
}; |
||||
JPanel compPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p}, new double[]{f}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-format"), compPane); |
||||
} |
||||
|
||||
private void checkFormatType() { |
||||
if (labelFormatType.getSelectedItem() == 1) { |
||||
formatPane.setVisible(true); |
||||
labelJsPane.setVisible(false); |
||||
} else { |
||||
formatPane.setVisible(false); |
||||
labelJsPane.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,363 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.chart.base.TextAttr; |
||||
import com.fr.design.event.UIObserver; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.gui.frpane.UINumberDragPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.comp.CustomFormatPane; |
||||
import com.fr.plugin.pielinecomb.comp.TextFormat; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
public class PieLineCombStyleAxisYPane extends ExtendedScrollPane<JSONObject> { |
||||
|
||||
private UICheckBox isTitleVisiable; |
||||
private TinyFormulaPane titleName; |
||||
private UIButtonGroup<Integer> titleAlignment; |
||||
private ChartTextAttrPane titleTextAttrPane; |
||||
private UINumberDragPane titleRotation; |
||||
|
||||
private UICheckBox isLabelVisiable; |
||||
private ChartTextAttrPane labelTextAttrPane; |
||||
private UINumberDragPane labelRotation; |
||||
|
||||
private UIButtonGroup<Integer> labelFormatType; |
||||
private CustomFormatPane formatPane; |
||||
private UITextArea labelJsPane; |
||||
|
||||
private UICheckBox showMinValue; |
||||
private UICheckBox showMaxValue; |
||||
private UICheckBox showInterval; |
||||
private TinyFormulaPane minValue; |
||||
private TinyFormulaPane maxValue; |
||||
private TinyFormulaPane intervalValue; |
||||
|
||||
private UIButtonGroup<String> position; |
||||
|
||||
private PieLineCombStylePane stylePane; |
||||
|
||||
public PieLineCombStyleAxisYPane(PieLineCombStylePane stylePane) { |
||||
this.stylePane = stylePane; |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(JSONObject chartConf) { |
||||
this.isTitleVisiable.setSelected(chartConf.getBoolean("isTitleVisiable")); |
||||
this.titleName.populateBean(chartConf.getString("titleName")); |
||||
this.titleAlignment.setSelectedItem(chartConf.getInt("titleAlignment")); |
||||
|
||||
FRFont textFont = FRFont.getInstance(chartConf.getString("titlefamily"), |
||||
chartConf.getInt("titlestyle"), |
||||
chartConf.getInt("titlesize"), |
||||
MapUtil.toColor(chartConf.getString("titlecolor"))); |
||||
this.titleTextAttrPane.populate(textFont); |
||||
|
||||
this.titleRotation.populateBean(chartConf.getDouble("titleRotation")); |
||||
|
||||
this.isLabelVisiable.setSelected(chartConf.getBoolean("isLabelVisiable")); |
||||
textFont = FRFont.getInstance(chartConf.getString("labelfamily"), |
||||
chartConf.getInt("labelstyle"), |
||||
chartConf.getInt("labelsize"), |
||||
MapUtil.toColor(chartConf.getString("labelcolor"))); |
||||
this.labelTextAttrPane.populate(textFont); |
||||
|
||||
this.labelRotation.populateBean(chartConf.getDouble("labelRotation")); |
||||
|
||||
this.labelFormatType.setSelectedItem(chartConf.getInt("labelFormatType")); |
||||
TextFormat format = new TextFormat(); |
||||
format.setType(chartConf.getInt("yformattype")); |
||||
format.setFormatStr(chartConf.getString("yformatstr")); |
||||
this.formatPane.populateBean(format); |
||||
this.labelJsPane.setText(chartConf.getString("labelJsPane")); |
||||
|
||||
this.showMinValue.setSelected(chartConf.getBoolean("showMinValue")); |
||||
this.showMaxValue.setSelected(chartConf.getBoolean("showMaxValue")); |
||||
this.showInterval.setSelected(chartConf.getBoolean("showInterval")); |
||||
|
||||
this.minValue.populateBean(chartConf.getString("minValue")); |
||||
this.maxValue.populateBean(chartConf.getString("maxValue")); |
||||
this.intervalValue.populateBean(chartConf.getString("intervalValue")); |
||||
|
||||
this.position.setSelectedItem(chartConf.getString("position")); |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(JSONObject json) { |
||||
} |
||||
|
||||
public JSONObject update() { |
||||
JSONObject chartConf = new JSONObject(); |
||||
chartConf.put("isTitleVisiable", isTitleVisiable.isSelected()); |
||||
chartConf.put("titleName", titleName.updateBean()); |
||||
chartConf.put("titleAlignment", titleAlignment.getSelectedItem()); |
||||
|
||||
TextAttr textAttr = this.titleTextAttrPane.update(); |
||||
chartConf.put("titlesize", textAttr.getFRFont().getSize()); |
||||
chartConf.put("titlestyle", textAttr.getFRFont().getStyle()); |
||||
chartConf.put("titlefamily", textAttr.getFRFont().getFamily()); |
||||
chartConf.put("titlecolor", MapUtil.toHex(textAttr.getFRFont().getForeground())); |
||||
|
||||
chartConf.put("titleRotation", titleRotation.updateBean()); |
||||
|
||||
chartConf.put("isLabelVisiable", isLabelVisiable.isSelected()); |
||||
textAttr = this.labelTextAttrPane.update(); |
||||
chartConf.put("labelsize", textAttr.getFRFont().getSize()); |
||||
chartConf.put("labelstyle", textAttr.getFRFont().getStyle()); |
||||
chartConf.put("labelfamily", textAttr.getFRFont().getFamily()); |
||||
chartConf.put("labelcolor", MapUtil.toHex(textAttr.getFRFont().getForeground())); |
||||
|
||||
chartConf.put("labelRotation", labelRotation.updateBean()); |
||||
|
||||
chartConf.put("labelFormatType", labelFormatType.getSelectedItem()); |
||||
TextFormat format = formatPane.updateBean(); |
||||
chartConf.put("yformatstr", format.getFormatStr()); |
||||
chartConf.put("yformattype", format.getType()); |
||||
chartConf.put("labelJsPane", labelJsPane.getText()); |
||||
|
||||
chartConf.put("showMinValue", showMinValue.isSelected()); |
||||
chartConf.put("showMaxValue", showMaxValue.isSelected()); |
||||
chartConf.put("showInterval", showInterval.isSelected()); |
||||
|
||||
chartConf.put("minValue", minValue.updateBean()); |
||||
chartConf.put("maxValue", maxValue.updateBean()); |
||||
chartConf.put("intervalValue", intervalValue.updateBean()); |
||||
|
||||
chartConf.put("position", position.getSelectedItem()); |
||||
|
||||
return chartConf; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-StyleAxisYTitle"); |
||||
} |
||||
|
||||
private class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
initListener(this); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel titlePane = createTitlePane(); |
||||
JPanel labelPane = createLabelPane(); |
||||
JPanel valuePane = createValuePane(); |
||||
JPanel posPane = createPositionPane(); |
||||
JPanel formatPane = createLabelFormatPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{titlePane}, |
||||
new Component[]{labelPane}, |
||||
new Component[]{valuePane}, |
||||
new Component[]{posPane}, |
||||
new Component[]{formatPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p, p, p, p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
|
||||
this.setVisible(true); |
||||
|
||||
} |
||||
|
||||
public void initListener(Container var1) { |
||||
for(int var2 = 0; var2 < var1.getComponentCount(); ++var2) { |
||||
Component var3 = var1.getComponent(var2); |
||||
if (var3 instanceof Container) { |
||||
this.initListener((Container)var3); |
||||
} |
||||
|
||||
if (var3 instanceof UIObserver) { |
||||
((UIObserver)var3).registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
PieLineCombStyleAxisYPane.this.stylePane.attributeChanged(); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
private JPanel createTitlePane() { |
||||
isTitleVisiable = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-isVisiableTitle")); |
||||
titleName = new TinyFormulaPane(); |
||||
|
||||
Icon[] titlePositonIcons = new Icon[]{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_top_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/v_down_normal.png")}; |
||||
Integer[] titlePositionVal = new Integer[]{2, 0, 4}; |
||||
this.titleAlignment = new UIButtonGroup(titlePositonIcons, titlePositionVal); |
||||
|
||||
titleRotation = new UINumberDragPane(-90, 90); |
||||
|
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-TitleText")), this.titleName}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-TitlePosition")), this.titleAlignment}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-textRotation")), this.titleRotation} |
||||
}; |
||||
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p, p, p}, new double[]{p, f}); |
||||
|
||||
|
||||
titleTextAttrPane = new ChartTextAttrPane(); |
||||
|
||||
Component[][] sumComp = new Component[][]{ |
||||
new Component[]{isTitleVisiable}, |
||||
new Component[]{panel}, |
||||
new Component[]{titleTextAttrPane} |
||||
}; |
||||
JPanel sumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(sumComp, new double[]{p, p, p}, new double[]{f}); |
||||
|
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleNameExpand"), sumPane); |
||||
|
||||
} |
||||
|
||||
private JPanel createLabelPane() { |
||||
isLabelVisiable = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-isLabelVisiable")); |
||||
labelTextAttrPane = new ChartTextAttrPane(); |
||||
labelRotation = new UINumberDragPane(-90, 90); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-textRotation")), this.labelRotation} |
||||
}; |
||||
JPanel rotatePane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p}, new double[]{p, f}); |
||||
|
||||
Component[][] sumComp = new Component[][]{ |
||||
new Component[]{isLabelVisiable}, |
||||
new Component[]{labelTextAttrPane}, |
||||
new Component[]{rotatePane} |
||||
}; |
||||
JPanel sumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(sumComp, new double[]{p, p, p}, new double[]{f}); |
||||
|
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-axisLabelTitle"), sumPane); |
||||
|
||||
} |
||||
|
||||
private JPanel createLabelFormatPane() { |
||||
labelFormatType = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-general"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-custom") |
||||
}, new Integer[]{1, 2}); |
||||
|
||||
labelFormatType.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
checkFormatType(); |
||||
} |
||||
}); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-labelFormatType")), this.labelFormatType} |
||||
}; |
||||
JPanel typePane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p}, new double[]{p, f}); |
||||
|
||||
|
||||
formatPane = new CustomFormatPane() { |
||||
@Override |
||||
protected Component[][] getComponent(JPanel var1, JPanel var2, JPanel var3) { |
||||
var3.setBorder(BorderFactory.createEmptyBorder()); |
||||
return new Component[][]{{var3, null}, {var2, null}}; |
||||
} |
||||
}; |
||||
|
||||
labelJsPane = new UITextArea(6, 6); |
||||
|
||||
JPanel contentPane = new JPanel(new BorderLayout()); |
||||
contentPane.add(formatPane, BorderLayout.NORTH); |
||||
contentPane.add(labelJsPane, BorderLayout.CENTER); |
||||
|
||||
labelJsPane.setVisible(false); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{typePane}, |
||||
new Component[]{contentPane} |
||||
}; |
||||
JPanel compPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p}, new double[]{f}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-format"), compPane); |
||||
} |
||||
|
||||
private JPanel createValuePane() { |
||||
showMinValue = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-minValue")); |
||||
showMaxValue = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-maxValue")); |
||||
showInterval = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-intervalValue")); |
||||
minValue = new TinyFormulaPane(); |
||||
maxValue = new TinyFormulaPane(); |
||||
intervalValue = new TinyFormulaPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{showMinValue, minValue}, |
||||
new Component[]{showMaxValue, maxValue}, |
||||
new Component[]{showInterval, intervalValue} |
||||
}; |
||||
JPanel valuePane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p, p}, new double[]{p, f}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-valueDefined"), valuePane); |
||||
} |
||||
|
||||
private JPanel createPositionPane() { |
||||
position = new UIButtonGroup<>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-left"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-right") |
||||
}, |
||||
new String[]{"left", "right"} |
||||
); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-yAxisPosition")), position} |
||||
}; |
||||
JPanel posPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p}, new double[]{p, f}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitlePosition"), posPane); |
||||
} |
||||
|
||||
private void checkFormatType() { |
||||
if (labelFormatType.getSelectedItem() == 1) { |
||||
formatPane.setVisible(true); |
||||
labelJsPane.setVisible(false); |
||||
} else { |
||||
formatPane.setVisible(false); |
||||
labelJsPane.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,210 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.config.predefined.ColorFillStyle; |
||||
import com.fr.design.gui.frpane.UINumberDragPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.plugin.pielinecomb.comp.CustomChartFillStylePane; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class PieLineCombStyleBgPane extends ExtendedScrollPane<PieLineCombChart> { |
||||
|
||||
private ColorSelectBox bgColor; |
||||
private UINumberDragPane bgOpacity; |
||||
private UICheckBox isShowZoomTool; |
||||
|
||||
private UIButtonGroup<Integer> chartType; |
||||
private CustomChartFillStylePane fillStylePane; |
||||
private ColorSelectBox gridXColor; |
||||
|
||||
private ColorSelectBox gridYColor; |
||||
private UISpinner fixHeight; |
||||
private BgGridCondListPane bgGridListPane; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = chart.getBgConf(); |
||||
|
||||
this.bgColor.setSelectObject(MapUtil.toColor(chartConf.getString("bgColor"))); |
||||
this.bgOpacity.populateBean(chartConf.getDouble("bgOpacity")); |
||||
this.isShowZoomTool.setSelected(chartConf.getBoolean("isShowZoomTool")); |
||||
this.gridXColor.setSelectObject(MapUtil.toColor(chartConf.getString("gridXColor"))); |
||||
this.gridYColor.setSelectObject(MapUtil.toColor(chartConf.getString("gridYColor"))); |
||||
this.fixHeight.setValue(chartConf.getDouble("fixHeight")); |
||||
this.chartType.setSelectedItem(chartConf.getInt("chartType")); |
||||
this.bgGridListPane.populateStyle(chart); |
||||
|
||||
String colors = chartConf.getString("gridXColorList"); |
||||
if (StringUtils.isNotEmpty(colors)) { |
||||
java.util.List<Color> colorList = new java.util.ArrayList<Color>(); |
||||
String[] colorArr = colors.split("\\|"); |
||||
for (int i = 0; i < colorArr.length; i++) { |
||||
colorList.add(MapUtil.toColor(colorArr[i])); |
||||
} |
||||
ColorFillStyle fillStyle = new ColorFillStyle(); |
||||
fillStyle.setColorStyle(1); |
||||
fillStyle.setColorList(colorList); |
||||
fillStyle.setCustomFillStyle(chartConf.getBoolean("gridXColorCustom")); |
||||
fillStyle.setFillStyleName(chartConf.getString("gridXColorName")); |
||||
this.fillStylePane.populateBean(fillStyle); |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = new JSONObject(); |
||||
|
||||
chartConf.put("bgColor", MapUtil.toHex(this.bgColor.getSelectObject())); |
||||
chartConf.put("bgOpacity", this.bgOpacity.updateBean()); |
||||
chartConf.put("isShowZoomTool", this.isShowZoomTool.isSelected()); |
||||
chartConf.put("gridXColor", MapUtil.toHex(this.gridXColor.getSelectObject())); |
||||
chartConf.put("gridYColor", MapUtil.toHex(this.gridYColor.getSelectObject())); |
||||
chartConf.put("fixHeight", this.fixHeight.getValue()); |
||||
chartConf.put("chartType", chartType.getSelectedItem()); |
||||
this.bgGridListPane.updateStyle(chart); |
||||
|
||||
ColorFillStyle fillStyle = this.fillStylePane.updateBean(); |
||||
java.util.List<Color> colorList = fillStyle.getColorList(); |
||||
StringBuffer colorStr = new StringBuffer(); |
||||
for (int i = 0; i < colorList.size(); i++) { |
||||
if (i > 0) { |
||||
colorStr.append("|"); |
||||
} |
||||
String tmpColor = MapUtil.toHex(colorList.get(i)); |
||||
colorStr.append(tmpColor); |
||||
} |
||||
chartConf.put("gridXColorList", colorStr.toString()); |
||||
chartConf.put("gridXColorName", fillStyle.getFillStyleName()); |
||||
chartConf.put("gridXColorCustom", fillStyle.isCustomFillStyle()); |
||||
|
||||
chart.setBgConf(chartConf); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-StyleBgTitle"); |
||||
} |
||||
|
||||
private class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel bgPane = createBgPane(); |
||||
JPanel xPane = createBgXPane(); |
||||
JPanel yPane = createBgYPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{bgPane}, |
||||
new Component[]{xPane}, |
||||
new Component[]{yPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p, p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
|
||||
this.setVisible(true); |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
private JPanel createBgYPane() { |
||||
this.gridYColor = new ColorSelectBox(100); |
||||
this.fixHeight = new UISpinner(0, 999999999, 1, 100); |
||||
this.bgGridListPane = new BgGridCondListPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-fixHeight")), this.fixHeight}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-lineColor")), this.gridYColor} |
||||
}; |
||||
JPanel gridPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p}, new double[]{p, f}); |
||||
|
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{gridPane}, |
||||
new Component[]{this.bgGridListPane} |
||||
}; |
||||
|
||||
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p}, new double[]{f}); |
||||
|
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-BgYTitleStyle"), pane); |
||||
} |
||||
|
||||
private JPanel createBgXPane() { |
||||
chartType = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typepie"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typeline") |
||||
}, |
||||
new Integer[]{1, 2} |
||||
); |
||||
chartType.setSelectedItem(1); |
||||
|
||||
this.gridXColor = new ColorSelectBox(100); |
||||
this.fillStylePane = new CustomChartFillStylePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-bgChartType")), this.chartType}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-lineColor")), this.gridXColor} |
||||
}; |
||||
JPanel gridPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p}, new double[]{p, f}); |
||||
|
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{gridPane}, |
||||
new Component[]{this.fillStylePane} |
||||
}; |
||||
|
||||
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p}, new double[]{f}); |
||||
|
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-BgXTitleStyle"), pane); |
||||
} |
||||
|
||||
private JPanel createBgPane() { |
||||
this.bgColor = new ColorSelectBox(100); |
||||
this.bgOpacity = new UINumberDragPane(0, 100); |
||||
this.isShowZoomTool = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-isShowZoomTool")); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-titleBgColor")), this.bgColor}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-titleBgOpacity")), this.bgOpacity}, |
||||
new Component[]{null, this.isShowZoomTool} |
||||
}; |
||||
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p, p}, new double[]{p, f}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-bgExpand"), pane); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,153 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
public class PieLineCombStyleLabelPane extends ExtendedScrollPane<PieLineCombChart> { |
||||
|
||||
private UIButtonGroup<Integer> chartType; |
||||
private CardLayout cardLayout; |
||||
private JPanel cardPane; |
||||
|
||||
/** |
||||
* 柱形图 配置 |
||||
* */ |
||||
private PieLabelStylePane pieLabelStylePane; |
||||
|
||||
/** |
||||
* 折线图 配置 |
||||
* */ |
||||
private LineLabelStylePane lineLabelStylePane; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = chart.getLabelConf(); |
||||
|
||||
this.chartType.setSelectedItem(chartConf.getInt("chartType")); |
||||
|
||||
this.pieLabelStylePane.populateBean(chartConf); |
||||
this.lineLabelStylePane.populateBean(chartConf); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = new JSONObject(); |
||||
|
||||
chartConf.put("chartType", this.chartType.getSelectedItem()); |
||||
|
||||
JSONObject pieLabel = this.pieLabelStylePane.update(); |
||||
JSONObject lineLabel = this.lineLabelStylePane.update(); |
||||
chartConf.mergeIn(pieLabel); |
||||
chartConf.mergeIn(lineLabel); |
||||
|
||||
chart.setLabelConf(chartConf); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-StyleLegendLabel"); |
||||
} |
||||
|
||||
private class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel mainPane = createMainPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{mainPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
private JPanel createChartTypePane() { |
||||
chartType = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typepie"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typeline") |
||||
}, |
||||
new Integer[]{1, 2} |
||||
); |
||||
chartType.setSelectedItem(1); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null}, |
||||
new Component[]{this.chartType} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
} |
||||
|
||||
|
||||
|
||||
private JPanel createMainPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
this.pieLabelStylePane = new PieLabelStylePane(); |
||||
this.lineLabelStylePane = new LineLabelStylePane(); |
||||
|
||||
JPanel chartTypePane = createChartTypePane(); |
||||
|
||||
cardPane = new JPanel(this.cardLayout = new CardLayout()){ |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if (null != chartType.getSelectedItem() && chartType.getSelectedItem() == 2) { |
||||
return lineLabelStylePane.getPreferredSize(); |
||||
} else { |
||||
return pieLabelStylePane.getPreferredSize(); |
||||
} |
||||
} |
||||
}; |
||||
cardPane.add(pieLabelStylePane, "pie"); |
||||
cardPane.add(lineLabelStylePane, "line"); |
||||
this.cardLayout.show(cardPane, "pie"); |
||||
chartType.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent var1x) { |
||||
if (chartType.getSelectedItem() == 1) { |
||||
cardLayout.show(cardPane, "pie"); |
||||
} else { |
||||
cardLayout.show(cardPane, "line"); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{chartTypePane}, |
||||
new Component[]{cardPane} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p}, new double[]{f}); |
||||
} |
||||
} |
@ -0,0 +1,139 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.chart.base.TextAttr; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class PieLineCombStyleLegendPane extends ExtendedScrollPane<PieLineCombChart> { |
||||
|
||||
private UICheckBox showlegend; |
||||
private UIButtonGroup<Integer> legendposition; |
||||
private UIButtonGroup<Integer> legendalignment; |
||||
private UISpinner legendmargin; |
||||
|
||||
private ChartTextAttrPane textAttrPane; |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = chart.getLegendConf(); |
||||
|
||||
this.showlegend.setSelected(chartConf.getBoolean("showlegend")); |
||||
this.legendposition.setSelectedItem(chartConf.getInt("legendposition")); |
||||
this.legendalignment.setSelectedItem(chartConf.getInt("legendalignment")); |
||||
this.legendmargin.setValue(chartConf.getDouble("legendmargin")); |
||||
|
||||
FRFont textFont = FRFont.getInstance(chartConf.getString("legendfamily"), |
||||
chartConf.getInt("legendstyle"), |
||||
chartConf.getInt("legendsize"), |
||||
MapUtil.toColor(chartConf.getString("legendcolor"))); |
||||
this.textAttrPane.populate(textFont); |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = new JSONObject(); |
||||
|
||||
chartConf.put("showlegend", this.showlegend.isSelected()); |
||||
chartConf.put("legendposition", this.legendposition.getSelectedItem()); |
||||
chartConf.put("legendalignment", this.legendalignment.getSelectedItem()); |
||||
chartConf.put("legendmargin", this.legendmargin.getValue()); |
||||
|
||||
TextAttr textAttr = this.textAttrPane.update(); |
||||
chartConf.put("legendsize", textAttr.getFRFont().getSize()); |
||||
chartConf.put("legendstyle", textAttr.getFRFont().getStyle()); |
||||
chartConf.put("legendfamily", textAttr.getFRFont().getFamily()); |
||||
chartConf.put("legendcolor", MapUtil.toHex(textAttr.getFRFont().getForeground())); |
||||
|
||||
chart.setLegendConf(chartConf); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-StyleLegendTitle"); |
||||
} |
||||
|
||||
private class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel positionPane = createLegendPosition(); |
||||
JPanel stylePane = createTitleStylePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{showlegend}, |
||||
new Component[]{positionPane}, |
||||
new Component[]{stylePane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p, p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
|
||||
this.setVisible(true); |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
private JPanel createLegendPosition(){ |
||||
String[] var3 = new String[]{Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Top"), Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Bottom"), Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Left"), Toolkit.i18nText("Fine-Design_Chart_Style_Alignment_Right")}; |
||||
Integer[] var4 = new Integer[]{1, 3, 2, 4}; |
||||
Icon[] var5 = new Icon[]{BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_top.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_bottom.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_left.png"), BaseUtils.readIcon("/com/fr/design/images/chart/ChartLegend/layout_right.png")}; |
||||
|
||||
this.legendposition = new UIButtonGroup(var5, var4); |
||||
this.legendposition.setAllToolTips(var3); |
||||
|
||||
this.showlegend = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-showylegend")); |
||||
|
||||
Icon[] titlePositonIcons = new Icon[]{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; |
||||
Integer[] titlePositionVal = new Integer[]{2, 0, 4}; |
||||
this.legendalignment = new UIButtonGroup(titlePositonIcons, titlePositionVal); |
||||
|
||||
this.legendmargin = new UISpinner(0, 500, 1, 20); |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-legendposition")), this.legendposition}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-legendalignment")), this.legendalignment}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-legendmargin")), this.legendmargin} |
||||
}; |
||||
|
||||
JPanel panel = TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p, p, p}, new double[]{p, f}); |
||||
|
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-ChartLegendPositionExpand"), panel); |
||||
|
||||
} |
||||
|
||||
private JPanel createTitleStylePane() { |
||||
this.textAttrPane = new ChartTextAttrPane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleStyle"), this.textAttrPane); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,42 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.extended.chart.AbstractExtendedStylePane; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/8/19 |
||||
*/ |
||||
public class PieLineCombStylePane extends AbstractExtendedStylePane<PieLineCombChart> { |
||||
|
||||
private AttributeChangeListener attributeChangeListener; |
||||
|
||||
public PieLineCombStylePane(){ |
||||
super(); |
||||
} |
||||
public PieLineCombStylePane(AttributeChangeListener attributeChangeListener){ |
||||
super(attributeChangeListener); |
||||
this.attributeChangeListener = attributeChangeListener; |
||||
} |
||||
|
||||
@Override |
||||
protected List<ExtendedScrollPane<PieLineCombChart>> initPaneList() { |
||||
List<ExtendedScrollPane<PieLineCombChart>> list = new ArrayList<ExtendedScrollPane<PieLineCombChart>>(); |
||||
list.add(new PieLineCombStyleTitlePane()); |
||||
list.add(new PieLineCombStyleLegendPane()); |
||||
list.add(new PieLineCombStyleLabelPane()); |
||||
list.add(new PieLineCombStyleSeriesPane()); |
||||
list.add(new PieLineCombStyleAxisPane(this)); |
||||
// list.add(new PieLineCombStyleAxisXPane());
|
||||
// list.add(new PieLineCombStyleAxisYPane());
|
||||
list.add(new PieLineCombStyleBgPane()); |
||||
list.add(new PieLineCombStyleTipsPane()); |
||||
list.add(new PieLineCombStyleAnimalPane()); |
||||
return list; |
||||
} |
||||
} |
@ -0,0 +1,372 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.config.predefined.ColorFillStyle; |
||||
import com.fr.design.gui.frpane.UINumberDragPaneWithPercent; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.chart.type.LineType; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.plugin.pielinecomb.comp.CustomChartFillStylePane; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
import com.fr.van.chart.designer.component.LineTypeComboBox; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
public class PieLineCombStyleSeriesPane extends ExtendedScrollPane<PieLineCombChart> { |
||||
|
||||
private CustomChartFillStylePane fillStylePane; |
||||
private UIButtonGroup<Integer> chartType; |
||||
|
||||
private CardLayout cardLayout; |
||||
private JPanel cardPane; |
||||
|
||||
/** |
||||
* 柱形图 |
||||
* */ |
||||
private UIButtonGroup<Integer> pieWidthType; |
||||
private UISpinner pieFixWidth; |
||||
private UINumberDragPaneWithPercent pieSeriesGapWidth; |
||||
|
||||
private SeriesAxisRelaCondListPane pieSeriesAxisRelaListPane; |
||||
|
||||
/** |
||||
* 折线图 |
||||
* */ |
||||
private LineTypeComboBox lineType; |
||||
private UISpinner lineWidth; |
||||
private UIButtonGroup<Integer> lineCornerType; |
||||
|
||||
private UIComboBox lineCornerShape; |
||||
private UIComboBox lineCornerColorType; |
||||
private ColorBackgroundQuickPane lineCornerColor; |
||||
private UISpinner lineCornerRadius; |
||||
private SeriesAxisRelaCondListPane lineSeriesAxisRelaListPane; |
||||
|
||||
|
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = chart.getSeriesConf(); |
||||
|
||||
String colors = chartConf.getString("seriesColorList"); |
||||
if (StringUtils.isNotEmpty(colors)) { |
||||
java.util.List<Color> colorList = new java.util.ArrayList<Color>(); |
||||
String[] colorArr = colors.split("\\|"); |
||||
for (int i = 0; i < colorArr.length; i++) { |
||||
colorList.add(MapUtil.toColor(colorArr[i])); |
||||
} |
||||
ColorFillStyle fillStyle = new ColorFillStyle(); |
||||
fillStyle.setColorStyle(1); |
||||
fillStyle.setColorList(colorList); |
||||
fillStyle.setCustomFillStyle(chartConf.getBoolean("seriesColorCustom")); |
||||
fillStyle.setFillStyleName(chartConf.getString("seriesColorName")); |
||||
this.fillStylePane.populateBean(fillStyle); |
||||
} |
||||
|
||||
this.chartType.setSelectedItem(chartConf.getInt("chartType")); |
||||
if (chartConf.getInt("chartType") == 2) { |
||||
this.cardLayout.show(cardPane, "line"); |
||||
} |
||||
|
||||
pieWidthType.setSelectedItem(chartConf.getInt("pieWidthType")); |
||||
pieFixWidth.setValue(chartConf.getDouble("pieFixWidth")); |
||||
pieSeriesGapWidth.populateBean(chartConf.getDouble("pieSeriesGapWidth")); |
||||
|
||||
lineType.setSelectedItem(LineType.parse(chartConf.getString("lineType"))); |
||||
lineWidth.setValue(chartConf.getDouble("lineWidth")); |
||||
lineCornerType.setSelectedItem(chartConf.getInt("lineCornerType")); |
||||
lineCornerShape.setSelectedItem(chartConf.getString("lineCornerShape")); |
||||
lineCornerColorType.setSelectedItem(chartConf.getString("lineCornerColorType")); |
||||
lineCornerColor.populateColor(MapUtil.toColor(chartConf.getString("lineCornerColor"))); |
||||
lineCornerRadius.setValue(chartConf.getDouble("lineCornerRadius")); |
||||
|
||||
pieSeriesAxisRelaListPane.populateStyle(chart); |
||||
lineSeriesAxisRelaListPane.populateStyle(chart); |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = new JSONObject(); |
||||
|
||||
ColorFillStyle fillStyle = this.fillStylePane.updateBean(); |
||||
java.util.List<Color> colorList = fillStyle.getColorList(); |
||||
StringBuffer colorStr = new StringBuffer(); |
||||
for (int i = 0; i < colorList.size(); i++) { |
||||
if (i > 0) { |
||||
colorStr.append("|"); |
||||
} |
||||
String tmpColor = MapUtil.toHex(colorList.get(i)); |
||||
colorStr.append(tmpColor); |
||||
} |
||||
chartConf.put("seriesColorList", colorStr.toString()); |
||||
chartConf.put("seriesColorName", fillStyle.getFillStyleName()); |
||||
chartConf.put("seriesColorCustom", fillStyle.isCustomFillStyle()); |
||||
chartConf.put("chartType", chartType.getSelectedItem()); |
||||
|
||||
chartConf.put("pieWidthType", pieWidthType.getSelectedItem()); |
||||
chartConf.put("pieFixWidth", pieFixWidth.getValue()); |
||||
chartConf.put("pieSeriesGapWidth", pieSeriesGapWidth.updateBean()); |
||||
|
||||
chartConf.put("lineType", ((LineType)lineType.getSelectedItem()).getStringType()); |
||||
chartConf.put("lineWidth", lineWidth.getValue()); |
||||
chartConf.put("lineCornerType", lineCornerType.getSelectedItem()); |
||||
chartConf.put("lineCornerShape", lineCornerShape.getSelectedItem()); |
||||
chartConf.put("lineCornerColorType", lineCornerColorType.getSelectedItem()); |
||||
chartConf.put("lineCornerColor", MapUtil.toHex(lineCornerColor.updateColor())); |
||||
chartConf.put("lineCornerRadius", lineCornerRadius.getValue()); |
||||
|
||||
chart.setSeriesConf(chartConf); |
||||
|
||||
pieSeriesAxisRelaListPane.updateStyle(chart); |
||||
lineSeriesAxisRelaListPane.updateStyle(chart); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-StyleSeriesTitle"); |
||||
} |
||||
|
||||
private class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel chartTypePane = createChartTypePane(); |
||||
JPanel mainPane = createMainPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{fillStylePane}, |
||||
new Component[]{chartTypePane}, |
||||
new Component[]{mainPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p, p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
|
||||
this.setVisible(true); |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
private JPanel createMainPane() { |
||||
fillStylePane = new CustomChartFillStylePane(); |
||||
|
||||
JPanel piePane = createPiePane(); |
||||
JPanel linePane = createLinePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
cardPane = new JPanel(this.cardLayout = new CardLayout()){ |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if (null != chartType.getSelectedItem() && chartType.getSelectedItem() == 2) { |
||||
return linePane.getPreferredSize(); |
||||
} else { |
||||
return piePane.getPreferredSize(); |
||||
} |
||||
} |
||||
}; |
||||
cardPane.add(piePane, "pie"); |
||||
cardPane.add(linePane, "line"); |
||||
this.cardLayout.show(cardPane, "pie"); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{cardPane} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createLinePane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
lineType = new LineTypeComboBox(new LineType[]{LineType.NONE, LineType.SOLID, LineType.DASHED}); |
||||
lineWidth = new UISpinner(0, 100, 1, 1); |
||||
lineCornerType = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-brokenLine"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-smoothLine") |
||||
}, |
||||
new Integer[]{0, 1} |
||||
); |
||||
Component[][] comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-lineType")), this.lineType}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-lineWidth")), this.lineWidth}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-lineCornerType")), this.lineCornerType} |
||||
}; |
||||
JPanel linePane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p, p}, new double[]{p, f}); |
||||
JPanel linePaneTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-LineStyle"), linePane); |
||||
|
||||
lineCornerShape = new UIComboBox(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Default"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-shapeCircle"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-shapeRect"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-shapeTriangle"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-shapeDiamond") |
||||
}); |
||||
lineCornerColorType = new UIComboBox(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-seriesColor"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-customColor") |
||||
}); |
||||
lineCornerColorType.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
if (lineCornerColorType.getSelectedIndex() == 0) { |
||||
lineCornerColor.setVisible(false); |
||||
} else { |
||||
lineCornerColor.setVisible(true); |
||||
} |
||||
} |
||||
}); |
||||
lineCornerColor = new ColorBackgroundQuickPane(); |
||||
JPanel cornerColorPane = new JPanel(new BorderLayout()); |
||||
cornerColorPane.add(lineCornerColor); |
||||
lineCornerColor.setVisible(false); |
||||
lineCornerRadius = new UISpinner(0, 100, 1, 6); |
||||
|
||||
comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-lineCornerShape")), this.lineCornerShape}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-lineCornerColorType")), this.lineCornerColorType}, |
||||
new Component[]{null, cornerColorPane}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-lineCornerRadius")), this.lineCornerRadius} |
||||
}; |
||||
JPanel cornerPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p, p, p}, new double[]{p, f}); |
||||
JPanel cornerPaneTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-CornerStyle"), cornerPane); |
||||
|
||||
lineSeriesAxisRelaListPane = new SeriesAxisRelaCondListPane("lineSeriesAxis"); |
||||
JPanel lineSeriesAxisPaneTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-seriesAxisRela"), lineSeriesAxisRelaListPane); |
||||
|
||||
comp = new Component[][]{ |
||||
new Component[]{linePaneTitle}, |
||||
new Component[]{cornerPaneTitle}, |
||||
new Component[]{lineSeriesAxisPaneTitle} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createPiePane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
pieWidthType = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-auto"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-custom") |
||||
}, |
||||
new Integer[]{1, 2} |
||||
); |
||||
|
||||
pieFixWidth = new UISpinner(0, 1000, 1, 15); |
||||
pieSeriesGapWidth = new UINumberDragPaneWithPercent(0, 100); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-seriesGapWidth")), this.pieSeriesGapWidth} |
||||
}; |
||||
final JPanel gapWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{p, f}); |
||||
|
||||
comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-barWidth")), this.pieFixWidth} |
||||
}; |
||||
final JPanel fixWidthPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{p, f}); |
||||
|
||||
JPanel widthPane = new JPanel(new BorderLayout()); |
||||
widthPane.add(gapWidthPane, BorderLayout.NORTH); |
||||
widthPane.add(fixWidthPane, BorderLayout.CENTER); |
||||
fixWidthPane.setVisible(false); |
||||
|
||||
pieWidthType.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent var1x) { |
||||
if (pieWidthType.getSelectedItem() == 1) { |
||||
gapWidthPane.setVisible(true); |
||||
fixWidthPane.setVisible(false); |
||||
} else { |
||||
gapWidthPane.setVisible(false); |
||||
fixWidthPane.setVisible(true); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-barWidthLabel")), this.pieWidthType} |
||||
}; |
||||
JPanel widthTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{p, f}); |
||||
|
||||
pieSeriesAxisRelaListPane = new SeriesAxisRelaCondListPane("pieSeriesAxis"); |
||||
JPanel pieSeriesAxisPaneTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-seriesAxisRela"), pieSeriesAxisRelaListPane); |
||||
|
||||
comp = new Component[][]{ |
||||
{widthTypePane}, |
||||
{widthPane} |
||||
}; |
||||
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p, p}, new double[]{f}); |
||||
JPanel paneTitle = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleStyle"), pane); |
||||
|
||||
comp = new Component[][]{ |
||||
{paneTitle}, |
||||
{pieSeriesAxisPaneTitle} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createChartTypePane() { |
||||
|
||||
chartType = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typepie"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typeline") |
||||
}, |
||||
new Integer[]{1, 2} |
||||
); |
||||
chartType.setSelectedItem(1); |
||||
|
||||
chartType.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent var1x) { |
||||
if (chartType.getSelectedItem() == 1) { |
||||
cardLayout.show(cardPane, "pie"); |
||||
} else { |
||||
cardLayout.show(cardPane, "line"); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null}, |
||||
new Component[]{this.chartType} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,161 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.frpane.UINumberDragPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
public class PieLineCombStyleTipsPane extends ExtendedScrollPane<PieLineCombChart> { |
||||
|
||||
private UIButtonGroup<Integer> chartType; |
||||
private JPanel cardPane; |
||||
|
||||
/** |
||||
* 柱形图 配置 |
||||
* */ |
||||
private PieLineTipsPane pieTipsPane; |
||||
|
||||
/** |
||||
* 折线图 配置 |
||||
* */ |
||||
private PieLineTipsPane lineTipsPane; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = chart.getTipsConf(); |
||||
|
||||
this.chartType.setSelectedItem(chartConf.getInt("chartType")); |
||||
|
||||
JSONObject pieTips = chartConf.getJSONObject("pie"); |
||||
if (null == pieTips) { |
||||
pieTips = JSONObject.create(); |
||||
} |
||||
this.pieTipsPane.populateBean(pieTips); |
||||
JSONObject lineTips = chartConf.getJSONObject("line"); |
||||
if (null == lineTips) { |
||||
lineTips = JSONObject.create(); |
||||
} |
||||
this.lineTipsPane.populateBean(lineTips); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(PieLineCombChart chart) { |
||||
JSONObject chartConf = new JSONObject(); |
||||
|
||||
chartConf.put("chartType", this.chartType.getSelectedItem()); |
||||
|
||||
JSONObject pieTips = this.pieTipsPane.update(); |
||||
JSONObject lineTips = this.lineTipsPane.update(); |
||||
chartConf.put("pie", pieTips); |
||||
chartConf.put("line", lineTips); |
||||
|
||||
chart.setTipsConf(chartConf); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-StyleLegendTips"); |
||||
} |
||||
|
||||
private class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel mainPane = createMainPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{mainPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
private JPanel createChartTypePane() { |
||||
chartType = new UIButtonGroup<Integer>(new String[]{ |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typepie"), |
||||
Toolkit.i18nText("Plugin-Pielinecomb-Typeline") |
||||
}, |
||||
new Integer[]{1, 2} |
||||
); |
||||
chartType.setSelectedItem(1); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null}, |
||||
new Component[]{this.chartType} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createMainPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
|
||||
this.pieTipsPane = new PieLineTipsPane(); |
||||
this.lineTipsPane = new PieLineTipsPane(); |
||||
|
||||
JPanel chartTypePane = createChartTypePane(); |
||||
|
||||
cardPane = new JPanel(new CardLayout()){ |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if (null != chartType.getSelectedItem() && chartType.getSelectedItem() == 2) { |
||||
return lineTipsPane.getPreferredSize(); |
||||
} else { |
||||
return pieTipsPane.getPreferredSize(); |
||||
} |
||||
} |
||||
}; |
||||
cardPane.add(pieTipsPane, "pie"); |
||||
cardPane.add(lineTipsPane, "line"); |
||||
((CardLayout)cardPane.getLayout()).show(cardPane, "pie"); |
||||
chartType.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent var1x) { |
||||
if (chartType.getSelectedItem() == 1) { |
||||
((CardLayout)cardPane.getLayout()).show(cardPane, "pie"); |
||||
} else { |
||||
((CardLayout)cardPane.getLayout()).show(cardPane, "line"); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{chartTypePane}, |
||||
new Component[]{cardPane} |
||||
}; |
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p}, new double[]{f}); |
||||
} |
||||
} |
@ -0,0 +1,142 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.chart.base.TextAttr; |
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.gui.frpane.UINumberDragPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.PaneTitleConstants; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.extended.chart.ExtendedScrollPane; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class PieLineCombStyleTitlePane extends ExtendedScrollPane<PieLineCombChart> { |
||||
|
||||
private UICheckBox isTitleVisable; |
||||
private ColorSelectBox titleBgColor; |
||||
private UINumberDragPane titleBgOpacity; |
||||
private TinyFormulaPane titleName; |
||||
private UIButtonGroup<Integer> titleAlignment; |
||||
private ChartTextAttrPane textAttrPane; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(PieLineCombChart chart) { |
||||
JSONObject titleConf = chart.getTitleConf(); |
||||
this.isTitleVisable.setSelected(titleConf.getBoolean("titlevisiable")); |
||||
this.titleBgColor.setSelectObject(MapUtil.toColor(titleConf.getString("titlebgcolor"))); |
||||
this.titleBgOpacity.populateBean(titleConf.getDouble("titleBgOpacity")); |
||||
this.titleName.populateBean(titleConf.getString("titlename")); |
||||
this.titleAlignment.setSelectedItem(titleConf.getInt("titleposition")); |
||||
|
||||
FRFont titleFont = FRFont.getInstance(titleConf.getString("titlefamily"), |
||||
titleConf.getInt("titlestyle"), |
||||
titleConf.getInt("titlesize"), |
||||
MapUtil.toColor(titleConf.getString("titlecolor"))); |
||||
this.textAttrPane.populate(titleFont); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(PieLineCombChart chart) { |
||||
JSONObject titleConf = JSONObject.create(); |
||||
titleConf.put("titlevisiable", this.isTitleVisable.isSelected()); |
||||
titleConf.put("titlebgcolor", MapUtil.toHex(this.titleBgColor.getSelectObject())); |
||||
titleConf.put("titleBgOpacity", this.titleBgOpacity.updateBean()); |
||||
titleConf.put("titlename", this.titleName.updateBean()); |
||||
titleConf.put("titleposition", titleAlignment.getSelectedItem()); |
||||
|
||||
TextAttr titleAttr = this.textAttrPane.update(); |
||||
titleConf.put("titlesize", titleAttr.getFRFont().getSize()); |
||||
titleConf.put("titlestyle", titleAttr.getFRFont().getStyle()); |
||||
titleConf.put("titlefamily", titleAttr.getFRFont().getFamily()); |
||||
titleConf.put("titlecolor", MapUtil.toHex(titleAttr.getFRFont().getForeground())); |
||||
|
||||
|
||||
chart.setTitleConf(titleConf); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return PaneTitleConstants.CHART_STYLE_TITLE_TITLE; |
||||
} |
||||
|
||||
private class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
// 内容
|
||||
JPanel titleContentPane = createTitleContentPane(); |
||||
// 样式
|
||||
JPanel stylePane = createTitleStylePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p, p}; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{isTitleVisable}, |
||||
new Component[]{titleContentPane}, |
||||
new Component[]{stylePane} |
||||
} ; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents,rowSize,columnSize); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
|
||||
this.setVisible(true); |
||||
|
||||
} |
||||
|
||||
} |
||||
|
||||
private JPanel createTitleContentPane(){ |
||||
// 内容
|
||||
this.isTitleVisable = new UICheckBox(Toolkit.i18nText("Plugin-Pielinecomb-isVisiableTitle")); |
||||
this.titleBgColor = new ColorSelectBox(100); |
||||
this.titleBgOpacity = new UINumberDragPane(0, 100); |
||||
this.titleName = new TinyFormulaPane(); |
||||
|
||||
// 位置
|
||||
Icon[] titlePositonIcons = new Icon[]{BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; |
||||
Integer[] titlePositionVal = new Integer[]{2, 0, 4}; |
||||
this.titleAlignment = new UIButtonGroup(titlePositonIcons, titlePositionVal); |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-titleBgColor")), this.titleBgColor}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-titleBgOpacity")), this.titleBgOpacity}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-TitleText")), this.titleName}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-TitlePosition"), 2), this.titleAlignment} |
||||
} ; |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleExpand"), components); |
||||
} |
||||
|
||||
private JPanel createTitleStylePane() { |
||||
this.textAttrPane = new ChartTextAttrPane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleStyle"), this.textAttrPane); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,148 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.plugin.pielinecomb.vo.ItemTipsJson; |
||||
import com.fr.van.chart.designer.AbstractVanChartScrollPane; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class PieLineCombTipsCondCreator extends AbstractVanChartScrollPane<CustomJsonObject> { |
||||
|
||||
private UITextArea condition; |
||||
|
||||
private PieLineTipsPane pieLineTipsPane; |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(CustomJsonObject json) { |
||||
JSONObject chartConf = null; |
||||
if (null != json) { |
||||
chartConf = json.get(); |
||||
} |
||||
if (null != chartConf) { |
||||
this.pieLineTipsPane.populateBean(chartConf); |
||||
this.condition.setText(chartConf.getString("condition")); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public CustomJsonObject updateBean() { |
||||
JSONObject chartConf = JSONObject.create(); |
||||
|
||||
chartConf.put("condition", this.condition.getText()); |
||||
|
||||
JSONObject tips = this.pieLineTipsPane.update(); |
||||
chartConf.mergeIn(tips); |
||||
|
||||
ItemTipsJson json = new ItemTipsJson(); |
||||
chartConf.put("title", json.getTilte()); |
||||
json.put(chartConf); |
||||
|
||||
return json; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-BmwGantt-Cond-condTaskBgTitle"); |
||||
} |
||||
|
||||
protected class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel condPane = createConditionPane(); |
||||
JPanel linePane = createLinePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{linePane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize); |
||||
this.add(panel, BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
private JPanel createLinePane() { |
||||
this.pieLineTipsPane = new PieLineTipsPane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleStyle"), this.pieLineTipsPane); |
||||
} |
||||
|
||||
private JPanel createConditionPane() { |
||||
condition = new UITextArea(3, 6); |
||||
final UITextField value = new UITextField(); |
||||
final UIComboBox filed = new UIComboBox(new String[]{"分类名", "系列名", "数值"}); |
||||
final UIComboBox cond = new UIComboBox(new String[]{"==", "!=", ">", ">=", "<", "<="}); |
||||
|
||||
UIButton add = new UIButton(Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion")); |
||||
UIButton clear = new UIButton(Toolkit.i18nText("Plugin-Pielinecomb-Cond-clearButton")); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{filed, cond, value, add, clear} |
||||
}; |
||||
JPanel condPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p}, new double[]{p, p, f, p, p}); |
||||
|
||||
Component[][] comp1 = new Component[][]{ |
||||
new Component[]{condition} |
||||
}; |
||||
JPanel areaPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, new double[]{p}, new double[]{f}); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{condPane}, |
||||
new Component[]{areaPane} |
||||
}; |
||||
JPanel sumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
|
||||
condition.setEnabled(false); |
||||
add.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
String srcStr = condition.getText(); |
||||
if (null != srcStr && !"".equals(srcStr)) { |
||||
srcStr += " && "; |
||||
} |
||||
String condstr = "'{" + filed.getSelectedItem() + "}' " + cond.getSelectedItem() + " '" + value.getText() + "'"; |
||||
condition.setText(srcStr + condstr); |
||||
} |
||||
}); |
||||
clear.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
condition.setText(""); |
||||
} |
||||
}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-condition"), sumPane); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,208 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.chart.base.TextAttr; |
||||
import com.fr.design.gui.frpane.UINumberDragPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/22 |
||||
*/ |
||||
public class PieLineTipsPane extends JPanel { |
||||
|
||||
private UIButtonGroup<Integer> valueType; |
||||
private JPanel cardPane; |
||||
|
||||
private UICheckBox showTip; |
||||
private UICheckBox showCategory; |
||||
private UICheckBox showSeries; |
||||
private UICheckBox showValue; |
||||
private UITextArea jsPane; |
||||
private ChartTextAttrPane textAttrPane; |
||||
|
||||
private ColorSelectBox bgColor; |
||||
private UINumberDragPane bgOpacity; |
||||
|
||||
public PieLineTipsPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
public void populateBean(JSONObject chartConf) { |
||||
this.showTip.setSelected(chartConf.getBoolean("showTip")); |
||||
this.valueType.setSelectedItem(chartConf.getInt("valueType")); |
||||
this.showCategory.setSelected(chartConf.getBoolean("showCategory")); |
||||
this.showSeries.setSelected(chartConf.getBoolean("showSeries")); |
||||
this.showValue.setSelected(chartConf.getBoolean("showValue")); |
||||
this.jsPane.setText(chartConf.getString("jsPane")); |
||||
|
||||
FRFont textFont = FRFont.getInstance(chartConf.getString("tipfamily"), |
||||
chartConf.getInt("tipstyle"), |
||||
chartConf.getInt("tipsize"), |
||||
MapUtil.toColor(chartConf.getString("tipcolor"))); |
||||
this.textAttrPane.populate(textFont); |
||||
|
||||
this.bgColor.setSelectObject(MapUtil.toColor(chartConf.getString("bgColor"))); |
||||
this.bgOpacity.populateBean(chartConf.getDouble("bgOpacity")); |
||||
|
||||
if (chartConf.getInt("valueType") == 2) { |
||||
((CardLayout)cardPane.getLayout()).show(cardPane, "piejs"); |
||||
} else { |
||||
((CardLayout)cardPane.getLayout()).show(cardPane, "piecheck"); |
||||
} |
||||
|
||||
} |
||||
|
||||
public JSONObject update() { |
||||
JSONObject chartConf = JSONObject.create(); |
||||
|
||||
chartConf.put("showTip", this.showTip.isSelected()); |
||||
chartConf.put("valueType", this.valueType.getSelectedItem()); |
||||
chartConf.put("showCategory", this.showCategory.isSelected()); |
||||
chartConf.put("showSeries", this.showSeries.isSelected()); |
||||
chartConf.put("showValue", this.showValue.isSelected()); |
||||
chartConf.put("jsPane", this.jsPane.getText()); |
||||
|
||||
TextAttr textAttr = this.textAttrPane.update(); |
||||
chartConf.put("tipsize", textAttr.getFRFont().getSize()); |
||||
chartConf.put("tipstyle", textAttr.getFRFont().getStyle()); |
||||
chartConf.put("tipfamily", textAttr.getFRFont().getFamily()); |
||||
chartConf.put("tipcolor", MapUtil.toHex(textAttr.getFRFont().getForeground())); |
||||
|
||||
chartConf.put("bgColor", MapUtil.toHex(this.bgColor.getSelectObject())); |
||||
chartConf.put("bgOpacity", this.bgOpacity.updateBean()); |
||||
|
||||
return chartConf; |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel mainPane = createPieLabelPane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{mainPane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, new double[]{p, p}, new double[]{f}); |
||||
|
||||
this.add(panel,BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
|
||||
private JPanel createPieLabelPane() { |
||||
valueType = new UIButtonGroup<Integer>(new String[]{ |
||||
com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-general"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-custom") |
||||
}, |
||||
new Integer[]{1, 2} |
||||
); |
||||
valueType.setSelectedItem(1); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null}, |
||||
new Component[]{this.valueType} |
||||
}; |
||||
JPanel pieValueTypePane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p}, new double[]{f}); |
||||
|
||||
|
||||
showTip = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-showPieTip")); |
||||
|
||||
showCategory = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-showPieCategory")); |
||||
showSeries = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-showPieSeries")); |
||||
showValue = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Plugin-Pielinecomb-showPieValue")); |
||||
|
||||
Component[][] compCheck = new Component[][]{ |
||||
new Component[]{showCategory}, |
||||
new Component[]{showSeries}, |
||||
new Component[]{showValue} |
||||
}; |
||||
final JPanel checkPane = TableLayout4VanChartHelper.createGapTableLayoutPane(compCheck, new double[]{p, p, p, p}, new double[]{f}); |
||||
|
||||
jsPane = new UITextArea(6, 6); |
||||
|
||||
cardPane = new JPanel(new CardLayout()){ |
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
if (null != valueType.getSelectedItem() && valueType.getSelectedItem() == 2) { |
||||
return jsPane.getPreferredSize(); |
||||
} else { |
||||
return checkPane.getPreferredSize(); |
||||
} |
||||
} |
||||
}; |
||||
cardPane.add(checkPane, "piecheck"); |
||||
cardPane.add(jsPane, "piejs"); |
||||
((CardLayout)cardPane.getLayout()).show(cardPane, "piecheck"); |
||||
valueType.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent var1x) { |
||||
CardLayout card = (CardLayout)cardPane.getLayout(); |
||||
if (valueType.getSelectedItem() == 1) { |
||||
card.show(cardPane, "piecheck"); |
||||
} else { |
||||
card.show(cardPane, "piejs"); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
Component[][] contentComp = new Component[][]{ |
||||
new Component[]{pieValueTypePane}, |
||||
new Component[]{cardPane} |
||||
}; |
||||
JPanel contentCompPane = TableLayout4VanChartHelper.createGapTableLayoutPane(contentComp, new double[]{p, p, p}, new double[]{f}); |
||||
JPanel contentPane = TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleText"), contentCompPane); |
||||
|
||||
JPanel stylePane = createPieTextPane(); |
||||
|
||||
JPanel bgPane = createPieBgPane(); |
||||
|
||||
Component[][] comps = new Component[][]{ |
||||
new Component[]{showTip}, |
||||
new Component[]{contentPane}, |
||||
new Component[]{stylePane}, |
||||
new Component[]{bgPane} |
||||
}; |
||||
|
||||
return TableLayout4VanChartHelper.createGapTableLayoutPane(comps, new double[]{p, p, p, p, p}, new double[]{f}); |
||||
} |
||||
|
||||
private JPanel createPieTextPane() { |
||||
this.textAttrPane = new ChartTextAttrPane(); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-TitleStyle"), this.textAttrPane); |
||||
} |
||||
|
||||
private JPanel createPieBgPane() { |
||||
this.bgColor = new ColorSelectBox(100); |
||||
this.bgOpacity = new UINumberDragPane(0, 100); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] comp = new Component[][]{ |
||||
{null, null}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-titleBgColor")), this.bgColor}, |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-titleBgOpacity")), this.bgOpacity} |
||||
}; |
||||
JPanel pane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p}, new double[]{p, f}); |
||||
return TableLayout4VanChartHelper.createExpandablePaneWithTitle(Toolkit.i18nText("Plugin-Pielinecomb-bgExpand"), pane); |
||||
} |
||||
} |
@ -0,0 +1,190 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextarea.UITextArea; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.plugin.pielinecomb.vo.SeriesAxisRelaJson; |
||||
import com.fr.van.chart.designer.AbstractVanChartScrollPane; |
||||
import com.fr.van.chart.designer.TableLayout4VanChartHelper; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class SeriesAxisRelaCondCreator extends AbstractVanChartScrollPane<CustomJsonObject> { |
||||
|
||||
private UITextField seriesName; |
||||
private UIComboBox axisYName; |
||||
private PieLineCombChart chart; |
||||
|
||||
private UITextArea condition; |
||||
|
||||
public SeriesAxisRelaCondCreator() { |
||||
} |
||||
|
||||
public SeriesAxisRelaCondCreator(PieLineCombChart chart) { |
||||
this.chart = chart; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return new ContentPane(); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(CustomJsonObject json) { |
||||
JSONObject chartConf = null; |
||||
if (null != json) { |
||||
chartConf = json.get(); |
||||
} |
||||
if (null != chartConf) { |
||||
//this.seriesName.setText(chartConf.getString("seriesName"));
|
||||
this.condition.setText(chartConf.getString("condition")); |
||||
JSONArray axisYList = null; |
||||
if (null != chart) { |
||||
axisYList = chart.getAxisConf().getJSONArray("axisY"); |
||||
} |
||||
if (null != axisYList && axisYList.size() > 0) { |
||||
java.util.List<String> axisYArr = new java.util.ArrayList<>(); |
||||
for (int i = 0; i < axisYList.size(); i++) { |
||||
axisYArr.add(axisYList.getJSONObject(i).getString("axisName")); |
||||
} |
||||
this.axisYName.refreshBoxItems(axisYArr); |
||||
} |
||||
this.axisYName.setSelectedItem(chartConf.getString("axisYName")); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public CustomJsonObject updateBean() { |
||||
JSONObject chartConf = JSONObject.create(); |
||||
|
||||
//chartConf.put("seriesName", this.seriesName.getText());
|
||||
chartConf.put("condition", this.condition.getText()); |
||||
chartConf.put("axisYName", this.axisYName.getSelectedItem()); |
||||
|
||||
SeriesAxisRelaJson json = new SeriesAxisRelaJson(); |
||||
chartConf.put("title", json.getTilte()); |
||||
json.put(chartConf); |
||||
|
||||
return json; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-condition"); |
||||
} |
||||
|
||||
protected class ContentPane extends JPanel { |
||||
public ContentPane() { |
||||
initComponents(); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
|
||||
JPanel linePane = createLinePane(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {f}; |
||||
double[] rowSize = {p, p, p}; |
||||
Component[][] acomponents = new Component[][]{ |
||||
new Component[]{linePane} |
||||
}; |
||||
|
||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(acomponents, rowSize, columnSize); |
||||
this.add(panel, BorderLayout.CENTER); |
||||
this.setVisible(true); |
||||
} |
||||
} |
||||
|
||||
private JPanel createLinePane() { |
||||
java.util.List<String> axisYArr = new java.util.ArrayList<>(); |
||||
if (null != this.chart) { |
||||
JSONArray axisYList = chart.getAxisConf().getJSONArray("axisY"); |
||||
if (null != axisYList && axisYList.size() > 0) { |
||||
for (int i = 0; i < axisYList.size(); i++) { |
||||
axisYArr.add(axisYList.getJSONObject(i).getString("axisName")); |
||||
} |
||||
this.axisYName.refreshBoxItems(axisYArr); |
||||
} |
||||
} |
||||
if (axisYArr.isEmpty()) { |
||||
axisYArr.add("Y轴"); |
||||
} |
||||
//this.seriesName = new UITextField();
|
||||
this.axisYName = new UIComboBox(axisYArr.toArray(new String[axisYArr.size()])); |
||||
//this.axisYPane = new JPanel(new BorderLayout());
|
||||
//this.axisYPane.add(this.axisYName, BorderLayout.CENTER);
|
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
Component[][] components = new Component[][]{ |
||||
new Component[]{new UILabel(Toolkit.i18nText("Plugin-Pielinecomb-StyleAxisTitle")), this.axisYName} |
||||
}; |
||||
JPanel yPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components, new double[]{p, p, p}, new double[]{p, f}); |
||||
|
||||
condition = new UITextArea(3, 6); |
||||
final UITextField value = new UITextField(); |
||||
final UIComboBox filed = new UIComboBox(new String[]{"系列序号", "系列名称"}); |
||||
final UIComboBox cond = new UIComboBox(new String[]{"==", ">", "<"}); |
||||
|
||||
UIButton add = new UIButton(Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion")); |
||||
UIButton clear = new UIButton(Toolkit.i18nText("Plugin-Pielinecomb-Cond-clearButton")); |
||||
|
||||
Component[][] compc = new Component[][]{ |
||||
new Component[]{filed, cond, value, add, clear} |
||||
}; |
||||
JPanel condPane = TableLayout4VanChartHelper.createGapTableLayoutPane(compc, new double[]{p, p}, new double[]{p, p, f, p, p}); |
||||
|
||||
Component[][] comp1 = new Component[][]{ |
||||
new Component[]{condition} |
||||
}; |
||||
JPanel areaPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp1, new double[]{p}, new double[]{f}); |
||||
|
||||
Component[][] comp = new Component[][]{ |
||||
new Component[]{yPane}, |
||||
new Component[]{condPane}, |
||||
new Component[]{areaPane} |
||||
}; |
||||
JPanel sumPane = TableLayout4VanChartHelper.createGapTableLayoutPane(comp, new double[]{p, p, p, p}, new double[]{f}); |
||||
|
||||
add.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
String srcStr = condition.getText(); |
||||
if (null != srcStr && !"".equals(srcStr)) { |
||||
srcStr += " && "; |
||||
} |
||||
String condstr = "'{" + filed.getSelectedItem() + "}' " + cond.getSelectedItem() + " '" + value.getText() + "'"; |
||||
condition.setText(srcStr + condstr); |
||||
} |
||||
}); |
||||
clear.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
condition.setText(""); |
||||
} |
||||
}); |
||||
|
||||
return sumPane; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,156 @@
|
||||
package com.fr.plugin.pielinecomb.ui; |
||||
|
||||
import com.fr.chart.chartattr.Plot; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.imenutable.UIMenuNameableCreator; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.plugin.pielinecomb.PieLineCombChart; |
||||
import com.fr.plugin.pielinecomb.vo.BgGridXJson; |
||||
import com.fr.plugin.pielinecomb.vo.CustomJsonObject; |
||||
import com.fr.plugin.pielinecomb.vo.SeriesAxisRelaJson; |
||||
import com.fr.stable.ListMap; |
||||
import com.fr.stable.Nameable; |
||||
import com.fr.van.chart.designer.component.VanChartUIListControlPane; |
||||
|
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
*/ |
||||
public class SeriesAxisRelaCondListPane extends VanChartUIListControlPane { |
||||
|
||||
private PieLineCombChart chart; |
||||
|
||||
private HashMap paneMap; |
||||
private HashMap jsonMap; |
||||
|
||||
private String chartType; |
||||
|
||||
public SeriesAxisRelaCondListPane(String chartType) { |
||||
this.chartType = chartType; |
||||
|
||||
paneMap = new HashMap(6); |
||||
paneMap.put(CustomJsonObject.SERIES_AXIS, SeriesAxisRelaCondCreator.class); |
||||
|
||||
jsonMap = new HashMap(6); |
||||
jsonMap.put(CustomJsonObject.SERIES_AXIS, SeriesAxisRelaJson.class); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void update(Plot plot) { |
||||
} |
||||
|
||||
public void populateStyle(PieLineCombChart chart) { |
||||
this.chart = chart; |
||||
|
||||
JSONObject styleCond = chart.getStyleCond(); |
||||
if (null != styleCond && null != styleCond.get(chartType)) { |
||||
JSONArray chartConf = styleCond.getJSONArray(chartType); |
||||
ArrayList noList = new ArrayList(); |
||||
for (int i = 0; null != chartConf && i < chartConf.size(); i++) { |
||||
JSONObject line = chartConf.getJSONObject(i); |
||||
if (null != line) { |
||||
try { |
||||
CustomJsonObject json = (CustomJsonObject)this.getJsonByTitle(line.getString("title")).newInstance(); |
||||
json.put(line); |
||||
json.get().put("axisY", chart.getAxisConf().getJSONArray("axisY")); |
||||
UIMenuNameableCreator var11 = new UIMenuNameableCreator(line.getString("titleName"), json, this.getEditPaneByTitle(line.getString("title"))); |
||||
noList.add(new NameObject(var11.getName(), var11.getObj())); |
||||
} catch (InstantiationException e) { |
||||
e.printStackTrace(); |
||||
} catch (IllegalAccessException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
this.populate((Nameable[])noList.toArray(new NameObject[noList.size()])); |
||||
this.doLayout(); |
||||
} |
||||
|
||||
} |
||||
|
||||
public void updateStyle(PieLineCombChart chart) { |
||||
Nameable[] nameables = this.update(); |
||||
|
||||
JSONArray objConf = JSONArray.create(); |
||||
for (int i = 0; i < nameables.length; i++) { |
||||
CustomJsonObject noObj = (CustomJsonObject)((NameObject)nameables[i]).getObject(); |
||||
if (null == noObj) { |
||||
noObj = new CustomJsonObject(); |
||||
noObj.put(JSONObject.create()); |
||||
} |
||||
if (null == noObj.get()) { |
||||
noObj.put(JSONObject.create()); |
||||
} |
||||
|
||||
noObj.get().put("titleName", ((NameObject)nameables[i]).getName()); |
||||
objConf.add(noObj.get()); |
||||
} |
||||
|
||||
if (null == chart.getStyleCond()) { |
||||
chart.setStyleCond(JSONObject.create()); |
||||
} |
||||
chart.getStyleCond().put(chartType, objConf); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
ListMap creatorMap = new ListMap(); |
||||
|
||||
NameableCreator grid = new NameObjectCreator(Toolkit.i18nText("Plugin-Pielinecomb-seriesAxisRela"), SeriesAxisRelaJson.class, SeriesAxisRelaCondCreator.class); |
||||
creatorMap.put(grid.menuName(), grid); |
||||
|
||||
return (NameableCreator[])creatorMap.values().toArray(new NameableCreator[creatorMap.size()]); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-Cond-AddCondtion"); |
||||
} |
||||
|
||||
@Override |
||||
protected String getAddItemText() { |
||||
return Toolkit.i18nText("Plugin-Pielinecomb-seriesAxis"); |
||||
} |
||||
|
||||
@Override |
||||
public BasicBeanPane createPaneByCreators(NameableCreator nameableCreator) { |
||||
Constructor var2 = null; |
||||
try { |
||||
var2 = nameableCreator.getUpdatePane().getConstructor(PieLineCombChart.class); |
||||
return (BasicBeanPane)var2.newInstance(chart); |
||||
} catch (InstantiationException var4) { |
||||
FineLoggerFactory.getLogger().error(var4.getMessage(), var4); |
||||
} catch (IllegalAccessException var5) { |
||||
FineLoggerFactory.getLogger().error(var5.getMessage(), var5); |
||||
} catch (NoSuchMethodException var6) { |
||||
return super.createPaneByCreators(nameableCreator); |
||||
} catch (InvocationTargetException var7) { |
||||
FineLoggerFactory.getLogger().error(var7.getMessage(), var7); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
private Class<? extends BasicBeanPane> getEditPaneByTitle(String title) { |
||||
return (Class)paneMap.get(title); |
||||
} |
||||
|
||||
private Class getJsonByTitle(String title) { |
||||
return (Class)jsonMap.get(title); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fr.plugin.pielinecomb.vo; |
||||
|
||||
/** |
||||
* @author :duan.jingliang |
||||
* @date :2022/10/22 18:35 |
||||
* @description: |
||||
*/ |
||||
public class BgGridXJson extends CustomJsonObject { |
||||
private String tilte = BG_GRID_X; |
||||
|
||||
public String getTilte() { |
||||
return tilte; |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.fr.plugin.pielinecomb.vo; |
||||
|
||||
import com.fr.json.JSONObject; |
||||
|
||||
/** |
||||
* @author :duan.jingliang |
||||
* @date :2022/10/22 18:33 |
||||
* @description: |
||||
*/ |
||||
public class CustomJsonObject { |
||||
private JSONObject obj = JSONObject.create(); |
||||
|
||||
public JSONObject get() { |
||||
return obj; |
||||
} |
||||
|
||||
public void put(JSONObject obj) { |
||||
this.obj = obj; |
||||
} |
||||
|
||||
public static final String ITEM_COLOR = "color"; |
||||
public static final String ITEM_LABEL = "label"; |
||||
public static final String ITEM_TIPS = "tips"; |
||||
public static final String BG_GRID_X = "bggridx"; |
||||
public static final String SERIES_AXIS = "seriesaxis"; |
||||
|
||||
} |
@ -0,0 +1,119 @@
|
||||
package com.fr.plugin.pielinecomb.vo; |
||||
|
||||
import com.fr.js.NameJavaScriptGroup; |
||||
import com.fr.stable.FCloneable; |
||||
import com.fr.stable.xml.XMLPrintWriter; |
||||
import com.fr.stable.xml.XMLReadable; |
||||
import com.fr.stable.xml.XMLableReader; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.HashMap; |
||||
import java.util.Iterator; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author duan.jingliang |
||||
* @date 2022/10/23 |
||||
*/ |
||||
public class HyperLinkObject implements XMLReadable, Serializable, FCloneable { |
||||
|
||||
public static final String XML_TAG_PIE = "CustomHyperLinkPie"; |
||||
public static final String XML_TAG_LINE = "CustomHyperLinkLine"; |
||||
|
||||
public static final String CHART_TYPE_PIE = "pie"; |
||||
public static final String CHART_TYPE_LINE = "line"; |
||||
|
||||
private Map<String, NameJavaScriptGroup> linkMap = new HashMap<>(); |
||||
|
||||
public NameJavaScriptGroup getNameJavaScriptGroup(String name) { |
||||
return this.linkMap.get(name); |
||||
} |
||||
|
||||
public void setNameJavaScriptGroup(String name, NameJavaScriptGroup nameGroup) { |
||||
this.linkMap.put(name, nameGroup); |
||||
} |
||||
|
||||
@Override |
||||
public void readXML(XMLableReader xmLableReader) { |
||||
|
||||
if (xmLableReader.isChildNode()) { |
||||
String tagName = xmLableReader.getTagName(); |
||||
if (XML_TAG_PIE.equals(tagName)) { |
||||
NameJavaScriptGroup obj = new NameJavaScriptGroup(); |
||||
xmLableReader.readXMLObject(obj); |
||||
this.linkMap.put(CHART_TYPE_PIE, obj); |
||||
} else if (XML_TAG_LINE.equals(tagName)) { |
||||
NameJavaScriptGroup obj = new NameJavaScriptGroup(); |
||||
xmLableReader.readXMLObject(obj); |
||||
this.linkMap.put(CHART_TYPE_LINE, obj); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void writeXML(XMLPrintWriter xmlWriter) { |
||||
if (null != this.linkMap && !this.linkMap.isEmpty()) { |
||||
NameJavaScriptGroup pieObj = this.linkMap.get(CHART_TYPE_PIE); |
||||
if (null != pieObj) { |
||||
xmlWriter.startTAG(XML_TAG_PIE); |
||||
pieObj.writeXML(xmlWriter); |
||||
xmlWriter.end(); |
||||
} |
||||
|
||||
NameJavaScriptGroup lineObj = this.linkMap.get(CHART_TYPE_LINE); |
||||
if (null != lineObj) { |
||||
xmlWriter.startTAG(XML_TAG_LINE); |
||||
lineObj.writeXML(xmlWriter); |
||||
xmlWriter.end(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public Object clone() throws CloneNotSupportedException { |
||||
HyperLinkObject obj = (HyperLinkObject)super.clone(); |
||||
Map<String, NameJavaScriptGroup> newLinkMap = new HashMap<>(); |
||||
if (null != this.linkMap && !this.linkMap.isEmpty()) { |
||||
Iterator<String> it = this.linkMap.keySet().iterator(); |
||||
while(it.hasNext()) { |
||||
String name = it.next(); |
||||
newLinkMap.put(name, (NameJavaScriptGroup)this.linkMap.get(name).clone()); |
||||
} |
||||
obj.linkMap = newLinkMap; |
||||
} |
||||
return obj; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object srcObj) { |
||||
if (!(srcObj instanceof HyperLinkObject)) { |
||||
return false; |
||||
} else { |
||||
HyperLinkObject srcHyperLink = (HyperLinkObject)srcObj; |
||||
if (this.linkMap.size() != srcHyperLink.linkMap.size()) { |
||||
return false; |
||||
} else { |
||||
if ((null != this.linkMap.get(CHART_TYPE_PIE) && null == srcHyperLink.linkMap.get(CHART_TYPE_PIE)) || |
||||
(null == this.linkMap.get(CHART_TYPE_PIE) && null != srcHyperLink.linkMap.get(CHART_TYPE_PIE))) { |
||||
return false; |
||||
} |
||||
if (null != this.linkMap.get(CHART_TYPE_PIE) |
||||
&& null != srcHyperLink.linkMap.get(CHART_TYPE_PIE) |
||||
&& !this.linkMap.get(CHART_TYPE_PIE).equals(srcHyperLink.linkMap.get(CHART_TYPE_PIE))) { |
||||
return false; |
||||
} |
||||
|
||||
if ((null != this.linkMap.get(CHART_TYPE_LINE) && null == srcHyperLink.linkMap.get(CHART_TYPE_LINE)) || |
||||
(null == this.linkMap.get(CHART_TYPE_LINE) && null != srcHyperLink.linkMap.get(CHART_TYPE_LINE))) { |
||||
return false; |
||||
} |
||||
if (null != this.linkMap.get(CHART_TYPE_LINE) |
||||
&& null != srcHyperLink.linkMap.get(CHART_TYPE_LINE) |
||||
&& !this.linkMap.get(CHART_TYPE_LINE).equals(srcHyperLink.linkMap.get(CHART_TYPE_LINE))) { |
||||
return false; |
||||
} |
||||
} |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fr.plugin.pielinecomb.vo; |
||||
|
||||
/** |
||||
* @author :duan.jingliang |
||||
* @date :2022/10/22 18:35 |
||||
* @description: |
||||
*/ |
||||
public class ItemColorJson extends CustomJsonObject { |
||||
private String tilte = ITEM_COLOR; |
||||
|
||||
public String getTilte() { |
||||
return tilte; |
||||
} |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fr.plugin.pielinecomb.vo; |
||||
|
||||
/** |
||||
* @author :duan.jingliang |
||||
* @date :2022/10/22 18:35 |
||||
* @description: |
||||
*/ |
||||
public class ItemLabelJson extends CustomJsonObject { |
||||
private String tilte = ITEM_LABEL; |
||||
|
||||
public String getTilte() { |
||||
return tilte; |
||||
} |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fr.plugin.pielinecomb.vo; |
||||
|
||||
/** |
||||
* @author :duan.jingliang |
||||
* @date :2022/10/22 18:35 |
||||
* @description: |
||||
*/ |
||||
public class ItemTipsJson extends CustomJsonObject { |
||||
private String tilte = ITEM_TIPS; |
||||
|
||||
public String getTilte() { |
||||
return tilte; |
||||
} |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fr.plugin.pielinecomb.vo; |
||||
|
||||
/** |
||||
* @author :duan.jingliang |
||||
* @date :2022/10/22 18:35 |
||||
* @description: |
||||
*/ |
||||
public class SeriesAxisRelaJson extends CustomJsonObject { |
||||
private String tilte = SERIES_AXIS; |
||||
|
||||
public String getTilte() { |
||||
return tilte; |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,102 @@
|
||||
(function () { |
||||
var system = require('system'); |
||||
var fs = require('fs'); |
||||
var config = { |
||||
FR: 'fr.js', |
||||
JQUERY: 'jquery.js', |
||||
ECHARTS: 'echarts.js', |
||||
CHARTWRAPPER: 'chartwrapper.js', |
||||
CHARTDATA: 'chartdata.js', |
||||
DEFAULT_WIDTH: '150', |
||||
DEFAULT_HEIGHT: '150' |
||||
}, parseParams, render; |
||||
|
||||
// 处理参数
|
||||
parseParams = function () { |
||||
var map = {}, i, key; |
||||
if (system.args.length < 2) { |
||||
phantom.exit(); |
||||
} |
||||
for (i = 0; i < system.args.length; i += 1) { |
||||
if (system.args[i].charAt(0) === '-') { |
||||
key = system.args[i].substr(1, i.length); |
||||
if (key === 'infile') { |
||||
// get string from file
|
||||
// force translate the key from infile to options.
|
||||
key = 'options'; |
||||
try { |
||||
map[key] = fs.read(system.args[i + 1]).replace(/^\s+/, ''); |
||||
} catch (e) { |
||||
console.log('Error: cannot find file, ' + system.args[i + 1]); |
||||
phantom.exit(); |
||||
} |
||||
} else { |
||||
map[key] = system.args[i + 1].replace(/^\s+/, ''); |
||||
} |
||||
} |
||||
} |
||||
return map; |
||||
}; |
||||
|
||||
render = function (params) { |
||||
var page = require('webpage').create(), createChart; |
||||
|
||||
page.onConsoleMessage = function (msg) { |
||||
console.log(msg); |
||||
}; |
||||
|
||||
page.onAlert = function (msg) { |
||||
console.log(msg); |
||||
}; |
||||
|
||||
createChart = function (chartname, width, height) { |
||||
|
||||
// we render the image, so we need set background to white.
|
||||
//$(document.body).css('backgroundColor', 'white');
|
||||
var container = $("<div>").appendTo(document.body); |
||||
container.attr('id', 'container'); |
||||
container.css({ |
||||
width: width, |
||||
height: height |
||||
}); |
||||
// render the chart
|
||||
|
||||
var chart = new window[chartname]; |
||||
var chartInst = chart._init(container[0], window.chartOptions); |
||||
return chart.getChartImage() || chartInst.getDataURL(); |
||||
|
||||
}; |
||||
|
||||
// parse the params
|
||||
page.open("about:blank", function (status) { |
||||
// inject the dependency js
|
||||
page.injectJs(config.FR); |
||||
page.injectJs(config.JQUERY); |
||||
page.injectJs(config.ECHARTS); |
||||
page.injectJs(config.CHARTDATA); |
||||
page.injectJs(config.CHARTWRAPPER); |
||||
|
||||
// create the chart
|
||||
var base64 = page.evaluate(createChart, params.chartname, params.width, params.height); |
||||
|
||||
setTimeout(function() { |
||||
base64 = page.evaluate(function() { |
||||
return window.PieLineCombChartInst.getChartImage(); |
||||
}); |
||||
|
||||
console.log(base64); |
||||
// exit
|
||||
phantom.exit(); |
||||
|
||||
}, 1000); |
||||
|
||||
|
||||
}); |
||||
}; |
||||
|
||||
// get the args
|
||||
var params = parseParams(); |
||||
|
||||
// render the image
|
||||
render(params); |
||||
}()); |
@ -0,0 +1,25 @@
|
||||
ExtendedChart = function () { |
||||
return this; |
||||
}; |
||||
|
||||
ExtendedChart.extend = function (props) { |
||||
|
||||
var NewClass = function () { |
||||
}; |
||||
|
||||
_extend(NewClass.prototype, props); //将参数复制到NewClass的prototype中
|
||||
|
||||
return NewClass; |
||||
}; |
||||
|
||||
function _extend(dest) { |
||||
var i, j, len, src; |
||||
|
||||
for (j = 1, len = arguments.length; j < len; j++) { |
||||
src = arguments[j]; |
||||
for (i in src) { |
||||
dest[i] = src[i]; |
||||
} |
||||
} |
||||
return dest; |
||||
} |
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue