Browse Source

提交开源任务材料

10.0
LAPTOP-SB56SG4Q\86185 3 years ago
parent
commit
b4f9286eba
  1. BIN
      JSD-8163-需求确认书V3.docx
  2. 5
      README.md
  3. BIN
      lib/finekit-10.0.jar
  4. 19
      plugin.xml
  5. 528
      src/main/java/com/fr/plugin/third/party/jsdibgd/CustomChartConfig.java
  6. 61
      src/main/java/com/fr/plugin/third/party/jsdibgd/CustomChartType.java
  7. 63
      src/main/java/com/fr/plugin/third/party/jsdibgd/CustomChartUI.java
  8. 244
      src/main/java/com/fr/plugin/third/party/jsdibgd/DataFactory.java
  9. 39
      src/main/java/com/fr/plugin/third/party/jsdibgd/UIComboBoxWithNone.java
  10. 197
      src/main/java/com/fr/plugin/third/party/jsdibgd/color/ColorUtils.java
  11. 89
      src/main/java/com/fr/plugin/third/party/jsdibgd/data/DataCellFieldsPane.java
  12. 129
      src/main/java/com/fr/plugin/third/party/jsdibgd/data/DataColumnFieldCollection.java
  13. 93
      src/main/java/com/fr/plugin/third/party/jsdibgd/data/DataSetFieldsPane.java
  14. 59
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/ColorSectionPane.java
  15. 251
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/ColorSeriesConfPane.java
  16. 46
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/ColorSettingPane.java
  17. 461
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CustomFRFontPane.java
  18. 49
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CustomGanttTypePane.java
  19. 72
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CustomMultiTabPane.java
  20. 55
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CustomStyleContentPane.java
  21. 33
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CustomStylePane.java
  22. 79
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CylinderWidthConfPane.java
  23. 51
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/DisplayScaleConfPane.java
  24. 74
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/LinkageConfPane.java
  25. 45
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/spinner/CustomUIBoundSpinner.java
  26. 399
      src/main/java/com/fr/plugin/third/party/jsdibgd/ui/spinner/CustomUISpinner.java
  27. BIN
      src/main/resources/com/fr/plugin/third/party/jsdibgd/images/beam.png
  28. BIN
      src/main/resources/com/fr/plugin/third/party/jsdibgd/images/chart_icon.png
  29. BIN
      src/main/resources/com/fr/plugin/third/party/jsdibgd/images/chart_type.png
  30. BIN
      src/main/resources/com/fr/plugin/third/party/jsdibgd/images/chart_type_demo.png
  31. BIN
      src/main/resources/com/fr/plugin/third/party/jsdibgd/images/label_bg.png
  32. BIN
      src/main/resources/com/fr/plugin/third/party/jsdibgd/images/point.png
  33. BIN
      src/main/resources/com/fr/plugin/third/party/jsdibgd/images/triangle.png
  34. 52
      src/main/resources/com/fr/plugin/third/party/jsdibgd/web/common.css
  35. 420
      src/main/resources/com/fr/plugin/third/party/jsdibgd/web/customChartWrapper.js
  36. 919
      src/main/resources/com/fr/plugin/third/party/jsdibgd/web/custom_map.js
  37. 7
      src/main/resources/com/fr/plugin/third/party/jsdibgd/web/echarts-adapter.js
  38. 1
      src/main/resources/com/fr/plugin/third/party/jsdibgd/web/echarts-gl.min.js
  39. 45
      src/main/resources/com/fr/plugin/third/party/jsdibgd/web/echarts.min.js
  40. BIN
      定制地图插件使用手册.docx

BIN
JSD-8163-需求确认书V3.docx

Binary file not shown.

5
README.md

@ -1,3 +1,6 @@
# open-JSD-8163
JSD-8163 开源任务材料
JSD-8163 开源任务材料\
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\
仅作为开发者学习参考使用!禁止用于任何商业用途!\
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。

BIN
lib/finekit-10.0.jar

Binary file not shown.

19
plugin.xml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plugin>
<id>com.fr.plugin.third.party.jsdibgd</id>
<name><![CDATA[定制轮播点地图]]></name>
<active>yes</active>
<version>0.17</version>
<env-version>10.0</env-version>
<jartime>2019-01-01</jartime>
<vendor>fr.open</vendor>
<description><![CDATA[]]></description>
<change-notes><![CDATA[]]></change-notes>
<extra-chart>
<ChartTypeProvider class="com.fr.plugin.third.party.jsdibgd.CustomChartType" chartID="CUSTOM_MAP_CHART_JSDibgd"/>
</extra-chart>
<extra-chart-designer>
<IndependentChartUIProvider class="com.fr.plugin.third.party.jsdibgd.CustomChartUI" chartID="CUSTOM_MAP_CHART_JSDibgd"/>
</extra-chart-designer>
<function-recorder class="com.fr.plugin.third.party.jsdibgd.CustomChartType"/>
</plugin>

528
src/main/java/com/fr/plugin/third/party/jsdibgd/CustomChartConfig.java

@ -0,0 +1,528 @@
package com.fr.plugin.third.party.jsdibgd;
import com.fanruan.api.log.LogKit;
import com.fanruan.api.report.chart.BaseChartWithData;
import com.fanruan.api.util.AssistKit;
import com.fanruan.api.util.IOKit;
import com.fanruan.api.util.StringKit;
import com.fr.base.Utils;
import com.fr.base.chart.cross.FormulaProcessor;
import com.fr.base.chart.result.WebChartIDInfo;
import com.fr.chart.ChartWebPara;
import com.fr.chart.ChartWebParaProvider;
import com.fr.extended.chart.HyperLinkPara;
import com.fr.general.FRFont;
import com.fr.general.GeneralUtils;
import com.fr.json.JSONArray;
import com.fr.json.JSONObject;
import com.fr.plugin.context.PluginContexts;
import com.fr.plugin.third.party.jsdibgd.color.ColorUtils;
import com.fr.plugin.third.party.jsdibgd.data.DataColumnFieldCollection;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fr.web.core.SessionPoolManager;
import com.fr.web.core.TemplateSessionIDInfo;
import java.awt.*;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
public class CustomChartConfig extends BaseChartWithData {
private static final String ID = "CUSTOM_MAP_CHART_JSDibgd";
private static final String XML_TAG_NAME = "CUSTOM_MAP_CHART_JSDibgd_attr";
private int selectedAreaColor = Color.YELLOW.getRGB();
private int positionDynamicColor = Color.RED.getRGB();
private FRFont stationNameFrFont = FRFont.getInstance();
private int mapSymbolSize = 15;
private int selectSymbolSize = 20;
private boolean linkEnable = false;
private String widgetNames = "";
private String paraName = "stationName";
public boolean isLinkEnable() {
return linkEnable;
}
public void setLinkEnable(boolean linkEnable) {
this.linkEnable = linkEnable;
}
public int getSelectSymbolSize() {
return selectSymbolSize;
}
public void setSelectSymbolSize(int selectSymbolSize) {
this.selectSymbolSize = selectSymbolSize;
}
public String getWidgetNames() {
return widgetNames;
}
public void setWidgetNames(String widgetNames) {
this.widgetNames = widgetNames;
}
public String getParaName() {
return paraName;
}
public void setParaName(String paraName) {
this.paraName = paraName;
}
public int getSelectedAreaColor() {
return selectedAreaColor;
}
public void setSelectedAreaColor(int selectedAreaColor) {
this.selectedAreaColor = selectedAreaColor;
}
public int getPositionDynamicColor() {
return positionDynamicColor;
}
public void setPositionDynamicColor(int positionDynamicColor) {
this.positionDynamicColor = positionDynamicColor;
}
public FRFont getStationNameFrFont() {
if (stationNameFrFont == null) {
return FRFont.getInstance();
}
return stationNameFrFont;
}
public void setStationNameFrFont(FRFont stationNameFrFont) {
this.stationNameFrFont = stationNameFrFont;
}
public int getMapSymbolSize() {
return mapSymbolSize;
}
public void setMapSymbolSize(int mapSymbolSize) {
this.mapSymbolSize = mapSymbolSize;
}
@Override
protected Image designImage(int width, int height, int resolution, ChartWebParaProvider chartWebPara) {
return IOKit.readImageWithCache("com/fr/plugin/third/party/jsdibgd/images/chart_type_demo.png");
}
@Override
protected Image exportImage(int width, int height, int resolution, ChartWebParaProvider chartWebPara) {
return null;
}
@Override
public CustomChartConfig clone() throws CloneNotSupportedException {
CustomChartConfig result = (CustomChartConfig) super.clone();
result.setSelectedAreaColor(this.getSelectedAreaColor());
result.setPositionDynamicColor(this.getPositionDynamicColor());
result.setStationNameFrFont(this.getStationNameFrFont());
result.setMapSymbolSize(this.getMapSymbolSize());
result.setSelectSymbolSize(this.getSelectSymbolSize());
result.setWidgetNames(this.getWidgetNames());
result.setParaName(this.getParaName());
result.setLinkEnable(this.isLinkEnable());
return result;
}
@Override
public int hashCode() {
return super.hashCode() + AssistKit.hashCode(this.getSelectedAreaColor()) + AssistKit.hashCode(this.getPositionDynamicColor()) + AssistKit.hashCode(this.getStationNameFrFont())
+ AssistKit.hashCode(this.getMapSymbolSize())
+ AssistKit.hashCode(this.getSelectSymbolSize())
+ AssistKit.hashCode(this.getWidgetNames())
+ AssistKit.hashCode(this.getParaName())
+ AssistKit.hashCode(this.isLinkEnable())
;
}
@Override
public boolean equals(Object ob) {
return super.equals(ob)
&& ob instanceof CustomChartConfig
&& AssistKit.equals(this.getSelectedAreaColor(), ((CustomChartConfig) ob).getSelectedAreaColor())
&& AssistKit.equals(this.getPositionDynamicColor(), ((CustomChartConfig) ob).getPositionDynamicColor())
&& AssistKit.equals(this.getStationNameFrFont(), ((CustomChartConfig) ob).getStationNameFrFont())
&& AssistKit.equals(this.getMapSymbolSize(), ((CustomChartConfig) ob).getMapSymbolSize())
&& AssistKit.equals(this.getSelectSymbolSize(), ((CustomChartConfig) ob).getSelectSymbolSize())
&& AssistKit.equals(this.getWidgetNames(), ((CustomChartConfig) ob).getWidgetNames())
&& AssistKit.equals(this.getParaName(), ((CustomChartConfig) ob).getParaName())
&& AssistKit.equals(this.isLinkEnable(), ((CustomChartConfig) ob).isLinkEnable())
;
}
@Override
public JSONObject createAttributeConfig(ChartWebParaProvider chartWebPara) {
JSONObject jsonObject = super.createAttributeConfig(chartWebPara);
jsonObject.put("dataStatus", false);
if (isDatasEmpty()) {
return jsonObject;
}
//添加认证
if (!PluginContexts.currentContext().isAvailable()) {
LogKit.error("The custom map plugin trial is over, please purchase a license");
return jsonObject;
}
JSONArray datasJson = createDatas();
jsonObject.put("configDatas", datasJson);
JSONObject mapConfigJson = new JSONObject();
mapConfigJson.put("selectedAreaColor", ColorUtils.rgbToHex(new Color(getSelectedAreaColor())));
mapConfigJson.put("positionDynamicColor", ColorUtils.rgbToHex(new Color(getPositionDynamicColor())));
mapConfigJson.put("mapSymbolSize", getMapSymbolSize());
mapConfigJson.put("selectSymbolSize", getSelectSymbolSize());
jsonObject.put("mapConfig", mapConfigJson);
JSONObject fontConfigJson = new JSONObject();
FRFont tempFrFont = getStationNameFrFont();
fontConfigJson.put("name", tempFrFont.getFamily());
fontConfigJson.put("size", Utils.round5(tempFrFont.getSize2D()));
fontConfigJson.put("color", ColorUtils.rgbToHex(tempFrFont.getForeground()));
jsonObject.put("stationNameFontConfig", fontConfigJson);
jsonObject.put("uuid", UUID.randomUUID().toString());
JSONObject linkageConfigJson = createLinkJson(chartWebPara);
jsonObject.put("linkageConfig", linkageConfigJson);
jsonObject.put("dataStatus", true);
return jsonObject;
}
@Override
public void dealFormula(FormulaProcessor formulaProcessor) {
super.dealFormula(formulaProcessor);
}
@Override
public String getID() {
return ID;
}
@Override
public void readAttr(XMLableReader xmLableReader) {
super.readAttr(xmLableReader);
setSelectedAreaColor(xmLableReader.getAttrAsInt("selectedAreaColor", Color.YELLOW.getRGB()));
setPositionDynamicColor(xmLableReader.getAttrAsInt("positionDynamicColor", Color.RED.getRGB()));
setMapSymbolSize(xmLableReader.getAttrAsInt("mapSymbolSize", 10));
setSelectSymbolSize(xmLableReader.getAttrAsInt("selectSymbolSize", 15));
setWidgetNames(xmLableReader.getAttrAsString("widgetNames", ""));
setParaName(xmLableReader.getAttrAsString("paraName", "stationName"));
setLinkEnable(xmLableReader.getAttrAsBoolean("linkEnable", false));
FRFont tempFrFont = FRFont.getInstance();
String fontName = xmLableReader.getAttrAsString("stationNameFontName", StringKit.EMPTY);
if (StringKit.isNotEmpty(fontName)) {
tempFrFont = tempFrFont.applyName(fontName);
}
String fontSize = xmLableReader.getAttrAsString("stationNameFontSize", "10");
tempFrFont = tempFrFont.applySize(Float.parseFloat(fontSize));
tempFrFont = tempFrFont.applyForeground(new Color(xmLableReader.getAttrAsInt("stationNameFontColor", 0)));
setStationNameFrFont(tempFrFont);
}
@Override
public void writeAttr(XMLPrintWriter xmlPrintWriter) {
super.writeAttr(xmlPrintWriter);
xmlPrintWriter.attr("selectedAreaColor", getSelectedAreaColor());
xmlPrintWriter.attr("positionDynamicColor", getPositionDynamicColor());
xmlPrintWriter.attr("mapSymbolSize", getMapSymbolSize());
xmlPrintWriter.attr("selectSymbolSize", getSelectSymbolSize());
xmlPrintWriter.attr("widgetNames", getWidgetNames());
xmlPrintWriter.attr("paraName", getParaName());
xmlPrintWriter.attr("linkEnable", isLinkEnable());
FRFont tempFrFont = getStationNameFrFont();
xmlPrintWriter.attr("stationNameFontName", tempFrFont.getFamily());
xmlPrintWriter.attr("stationNameFontSize", Utils.round5(tempFrFont.getSize2D()));
xmlPrintWriter.attr("stationNameFontColor", tempFrFont.getForeground().getRGB());
}
private JSONObject createLinkJson(ChartWebParaProvider chartWebParaProvider) {
JSONObject disableLinkJson = new JSONObject();
disableLinkJson.put("linkEnable", false);
if (!isLinkEnable()) {
return disableLinkJson;
}
if (chartWebParaProvider == null) {
return disableLinkJson;
}
if (!(chartWebParaProvider instanceof ChartWebPara)) {
return disableLinkJson;
}
String pName = trim(getParaName());
if (StringKit.isEmpty(pName)) {
return disableLinkJson;
}
ChartWebPara chartWebPara = (ChartWebPara) chartWebParaProvider;
String ownerChartName = getOwnerChartName(chartWebPara);
List<String> validWidgetNames = getValidWidgetNames(ownerChartName);
if (validWidgetNames.size() <= 0) {
return disableLinkJson;
}
String bookPath = getBookPath(chartWebPara);
JSONArray widgetArray = new JSONArray();
for (int i = 0, max = validWidgetNames.size() - 1; i <= max; i++) {
widgetArray.add(validWidgetNames.get(i));
}
JSONObject linkJson = new JSONObject();
linkJson.put("widgetNames", widgetArray);
linkJson.put("paraName", pName);
linkJson.put("bookPath", bookPath);
linkJson.put("linkEnable", true);
return linkJson;
}
private String getOwnerChartName(ChartWebPara chartWebPara) {
if (chartWebPara == null) {
return "";
}
WebChartIDInfo chartIDInfo = chartWebPara.getChartIDInfo();
String ownerChartName = chartIDInfo.getName();
if (StringKit.isNotEmpty(ownerChartName)) {
ownerChartName = ownerChartName.toUpperCase();
}
return ownerChartName;
}
private String getBookPath(ChartWebPara chartWebPara) {
if (chartWebPara == null) {
return "";
}
String sessionID = chartWebPara.getSessionID();
TemplateSessionIDInfo templateSessionIDInfo = (TemplateSessionIDInfo) SessionPoolManager.getSessionIDInfor(sessionID, TemplateSessionIDInfo.class);
if (templateSessionIDInfo == null) {
return "";
}
String path = templateSessionIDInfo.getRelativePath();
return path;
}
private List<String> getValidWidgetNames(String ownerChartName) {
List<String> names = new ArrayList<>();
String wName = trim(getWidgetNames());
if (StringKit.isEmpty(wName)) {
return names;
}
wName = wName.replace(",", ",");
String[] tempNames = wName.split(",");
if ((tempNames == null) || (tempNames.length <= 0)) {
return names;
}
String tempName;
for (int i = 0, max = tempNames.length - 1; i <= max; i++) {
tempName = tempNames[i];
tempName = trim(tempName);
if (StringKit.isEmpty(tempName)) {
continue;
}
tempName = tempName.toUpperCase();
if (tempName.equals(ownerChartName)) {
continue;
}
if (names.contains(tempName)) {
continue;
}
names.add(tempName);
}
return names;
}
private String trim(String value) {
String tempValue = StringKit.trim(value);
if (StringKit.isEmpty(tempValue)) {
return "";
}
return tempValue;
}
private List<Integer> toColorList(String content) {
List<Integer> tempColors = new ArrayList<>();
if (StringKit.isEmpty(content)) {
return tempColors;
}
content = content.trim();
if (StringKit.isEmpty(content)) {
return tempColors;
}
String[] tempArray = content.split(",");
if ((tempArray == null) || (tempArray.length <= 0)) {
return tempColors;
}
String tempValue;
int tempColorValue;
for (int i = 0, max = tempArray.length - 1; i <= max; i++) {
tempValue = tempArray[i];
tempColorValue = Integer.valueOf(tempValue);
tempColors.add(tempColorValue);
}
return tempColors;
}
private int getObjectValue(List<Object> objs) {
double tempValue = getObjectDoubleValue(objs);
Double doubleValue = new Double(tempValue);
int value = doubleValue.intValue();
return value;
}
private double getObjectDoubleValue(List<Object> objs) {
double value = 0;
if ((objs == null) || (objs.size() <= 0)) {
return -1;
}
try {
value = Double.valueOf(String.valueOf(objs.get(0)));
} catch (Exception e) {
value = -1;
}
return value;
}
private double getFinishRate(double monthFinishValue, double maxValue) {
double f = monthFinishValue * 1.00 / maxValue;
BigDecimal b = new BigDecimal(f);
double f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
return f1;
}
private JSONArray createDatas() {
JSONArray datasJson = new JSONArray();
DataColumnFieldCollection columnFieldCollection = getFieldCollection(DataColumnFieldCollection.class);
List<Object> areaNameValues = columnFieldCollection.getAreaName().getValues();
List<Object> deptNameValues = columnFieldCollection.getDeptName().getValues();
List<Object> outputValueValues = columnFieldCollection.getOutputValue().getValues();
List<Object> profitValues = columnFieldCollection.getProfit().getValues();
List<Object> cashFlowValues = columnFieldCollection.getCashFlow().getValues();
List<Object> newContractValues = columnFieldCollection.getNewContract().getValues();
List<Object> longitudeValues = columnFieldCollection.getLongitude().getValues();
List<Object> latitudeValues = columnFieldCollection.getLatitude().getValues();
JSONObject itemJson;
JSONArray placeJson;
String areaName,areaName1;
for (int i = 0, max = areaNameValues.size() - 1; i <= max; i++) {
itemJson = new JSONObject();
placeJson = new JSONArray();
areaName = getColumnValue(i, areaNameValues);
areaName1 = DataFactory.getAbbreviatedProvince(areaName);
itemJson.put("dataIndex", i);
itemJson.put("areaName", areaName);
itemJson.put("areaName1", areaName1);
itemJson.put("deptName", getColumnValue(i, deptNameValues));
itemJson.put("outputValue", getColumnValue(i, outputValueValues));
itemJson.put("profit", getColumnValue(i, profitValues));
itemJson.put("cashFlow", getColumnValue(i, cashFlowValues));
itemJson.put("newContract", getColumnValue(i, newContractValues));
placeJson.add(toDouble(getColumnValue(i, longitudeValues)));
placeJson.add(toDouble(getColumnValue(i, latitudeValues)));
itemJson.put("place",placeJson);
datasJson.add(itemJson);
}
return datasJson;
}
private double toDouble(Object obj) {
if (obj == null) {
return 0;
}
String tempStr = String.valueOf(obj);
if (StringKit.isEmpty(tempStr)) {
return 0;
}
double value = Double.valueOf(tempStr);
return value;
}
private String getColumnValue(int index, List<Object> values) {
if (isListEmpty(values) || (index >= values.size())) {
return "";
}
String value = GeneralUtils.objectToString(values.get(index));
value = StringKit.trim(value);
if (StringKit.isEmpty(value)) {
return "";
}
return value;
}
private boolean isListEmpty(List list) {
if ((list == null) || (list.size() <= 0)) {
return true;
}
return false;
}
private boolean isDatasEmpty() {
DataColumnFieldCollection columnFieldCollection = getFieldCollection(DataColumnFieldCollection.class);
List<Object> areaNameValues = columnFieldCollection.getAreaName().getValues();
if ((areaNameValues == null) || (areaNameValues.size() <= 0)) {
return true;
}
return false;
}
private static final HyperLinkPara deptNameHyperLinkPara = new HyperLinkPara() {
@Override
public String getName() {
return "部门名称";
}
@Override
public String getFormulaContent() {
return "deptName";
}
@Override
public String[] getProps() {
return new String[]{"data", "deptName"};
}
};
@Override
protected HyperLinkPara[] hyperLinkParas() {
return new HyperLinkPara[]{
deptNameHyperLinkPara,
};
}
}

61
src/main/java/com/fr/plugin/third/party/jsdibgd/CustomChartType.java

@ -0,0 +1,61 @@
package com.fr.plugin.third.party.jsdibgd;
import com.fanruan.api.report.chart.BaseChartType;
import com.fanruan.api.report.chart.BaseChartWithData;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.stable.fun.Authorize;
@EnableMetrics
@Authorize(callSignKey = "com.fr.plugin.third.party.jsdibgd")
public class CustomChartType extends BaseChartType {
/**
* 该种图表所有的图表对象实例比如柱形图就有堆积柱形图百分比堆积柱形图等等
*
* @return 所有的图表对象实例
*/
@Focus(id = "com.fr.plugin.third.party.jsdibgd", text = "plugin-jsd-ibgd", source = Original.PLUGIN)
public BaseChartWithData[] getChartTypes() {
return new BaseChartWithData[]{
new CustomChartConfig()
};
}
/**
* 图表在web端展现时需要的JS文件
*
* @return JS文件数组
*/
public String[] getRequiredJS() {
return new String[]{
"com/fr/plugin/third/party/jsdibgd/web/echarts.min.js",
"com/fr/plugin/third/party/jsdibgd/web/echarts-gl.min.js",
"com/fr/plugin/third/party/jsdibgd/web/custom_map.js",
"com/fr/plugin/third/party/jsdibgd/web/customChartWrapper.js",
};
}
/**
* 图表在web端展现时需要的CSS文件
*
* @return CSS文件数组
*/
public String[] getRequiredCss() {
return new String[]{
"com/fr/plugin/third/party/jsdibgd/web/common.css"
};
}
/**
* JS对象名该对象一般是一个函数执行后会在给定的dom中绘制图表
*
* @return JS对象名
*/
public String getWrapperName() {
return "customChartJsdibgdWrapper";
}
}

63
src/main/java/com/fr/plugin/third/party/jsdibgd/CustomChartUI.java

@ -0,0 +1,63 @@
package com.fr.plugin.third.party.jsdibgd;
import com.fanruan.api.design.chart.*;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.plugin.third.party.jsdibgd.data.DataCellFieldsPane;
import com.fr.plugin.third.party.jsdibgd.data.DataSetFieldsPane;
import com.fr.plugin.third.party.jsdibgd.ui.CustomGanttTypePane;
import com.fr.plugin.third.party.jsdibgd.ui.CustomStylePane;
public class CustomChartUI extends BaseChartTypeUI {
public String CHART_NAME = "定制轮播点地图";
@Override
public DefaultTypePane getPlotTypePane() {
return new CustomGanttTypePane();
}
@Override
public BaseDataPane getChartDataPane(AttributeChangeListener listener) {
return new BaseDataPane(listener) {
@Override
protected SingleDataPane createSingleDataPane() {
return new SingleDataPane(new DataSetFieldsPane(),
new DataCellFieldsPane()
);
}
};
}
@Override
public BaseOtherPane[] getAttrPaneArray(AttributeChangeListener listener) {
return new BaseOtherPane[]{
//new CustomGanttTitlePane(),
new CustomStylePane(),
// new CustomGanttShowSettingsPane(),
// new VanChartStylePane(listener),
new DefaultOtherPane()};
}
@Override
public String getIconPath() {
return "com/fr/plugin/third/party/jsdibgd/images/chart_icon.png";
}
@Override
public String getName() {
return CHART_NAME;
}
@Override
public String[] getSubName() {
return new String[]{
CHART_NAME
};
}
@Override
public String[] getDemoImagePath() {
return new String[]{
"com/fr/plugin/third/party/jsdibgd/images/chart_type_demo.png"
};
}
}

244
src/main/java/com/fr/plugin/third/party/jsdibgd/DataFactory.java

@ -0,0 +1,244 @@
package com.fr.plugin.third.party.jsdibgd;
import com.fanruan.api.util.StringKit;
import com.fr.general.GeneralUtils;
import com.fr.plugin.third.party.jsdibgd.data.DataColumnFieldCollection;
import java.awt.*;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.List;
public class DataFactory {
public static synchronized List<String> createProjectNames(DataColumnFieldCollection dataSource) {
List<String> projectList = new ArrayList<>();
if (dataSource == null) {
return projectList;
}
//List<Object> projectNames = dataSource.getProjectName().getValues();
List<Object> projectNames = null;
int size = projectNames.size();
if (size <= 0) {
return projectList;
}
String tempValue;
Object tempObj;
for (int i = 0, max = size - 1; i <= max; i++) {
tempObj = projectNames.get(i);
if (tempObj == null) {
tempValue = "";
addNotRepeatingObj(tempValue, projectList);
continue;
}
tempValue = GeneralUtils.objectToString(tempObj);
addNotRepeatingObj(tempValue, projectList);
}
Collections.reverse(projectList);
return projectList;
}
/**
* 针对echarts的bug处理,若系列名称有数字有中文,会默认按数字处理,有中文会显示NaN,故在前面加中文处理
*
* @param name
* @return
*/
private static String createSeriesName(String name) {
String tempName = name;
if (StringKit.isEmpty(name)) {
tempName = "";
}
return "甘特图" + tempName;
}
private static synchronized String objectToString(Object obj) {
String tempValue = GeneralUtils.objectToString(obj);
return tempValue;
}
private static ThreadLocal<SimpleDateFormat> threadLocalFormat = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyy-MM-dd");
}
};
private static ThreadLocal<SimpleDateFormat> threadLocalFormat1 = new ThreadLocal<SimpleDateFormat>() {
@Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
}
};
/**
* 转为时间戳
*
* @param obj
* @return
*/
private static synchronized long objectToTimestamp(Object obj) {
if (obj == null) {
return 0;
}
Date tempDate = null;
if (obj instanceof Date) {
tempDate = (Date) obj;
return tempDate.getTime();
}
String tempValue = GeneralUtils.objectToString(obj);
if (StringKit.isEmpty(tempValue)) {
return 0;
}
int length = tempValue.length();
try {
if (length == 10) {
tempDate = threadLocalFormat.get().parse(tempValue);
} else if (length == 19) {
tempDate = threadLocalFormat1.get().parse(tempValue);
}
} catch (Exception e) {
return 0;
}
if (tempDate != null) {
return tempDate.getTime();
}
return 0;
}
/**
* 转为0-1的四位小数
*
* @param obj
* @return
*/
private static synchronized double objectToRate(Object obj) {
if (obj == null) {
return 0;
}
double tempValue = 0;
if (obj instanceof Double) {
tempValue = (Double) obj;
} else {
String tempContent = objectToString(obj);
if (StringKit.isEmpty(tempContent)) {
return 0;
}
tempContent = tempContent.trim();
if (StringKit.isEmpty(tempContent)) {
return 0;
}
tempValue = Double.valueOf(tempContent);
}
if (tempValue <= 0) {
return 0;
}
if (tempValue >= 1) {
return 1;
}
BigDecimal bigDecimal = new BigDecimal(String.valueOf(tempValue));
tempValue = bigDecimal.setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
return tempValue;
}
private static synchronized String objectToRateShow(double value) {
BigDecimal bigDecimal = new BigDecimal(String.valueOf(value));
BigDecimal bigDecimal1 = new BigDecimal("100");
String tempValue = bigDecimal.multiply(bigDecimal1).doubleValue() + "%";
return tempValue;
}
private static synchronized void addNotRepeatingObj(String value, List<String> values) {
String tempValue = value;
if (StringKit.isEmpty(tempValue)) {
tempValue = "";
}
if (values.contains(tempValue)) {
return;
}
values.add(tempValue);
}
private static synchronized int getIndex(String value, List<String> values) {
int index = values.indexOf(value);
return index;
}
public static String rgbToHex(Color color) {
if (color == null) {
return "#000000";
}
String value = "#" + String.format("%02X", color.getRed()) + String.format("%02X", color.getGreen()) + String.format("%02X", color.getBlue());
return value;
}
public static Color colorToGray(Color color) {
if (color == null) {
return new Color(0);
}
int gray = (int) ((color.getRed() * 30 + color.getGreen() * 59 + color.getBlue() * 11 + 50) * 0.01);
return new Color(gray);
}
/**
* 省份缩写
*/
public static Map<String, String> PROVINCE_ABBREVIATION_DATAS = new HashMap<>();
static {
PROVINCE_ABBREVIATION_DATAS.put("河北省", "河北");
PROVINCE_ABBREVIATION_DATAS.put("山西省", "山西");
PROVINCE_ABBREVIATION_DATAS.put("辽宁省", "辽宁");
PROVINCE_ABBREVIATION_DATAS.put("吉林省", "吉林");
PROVINCE_ABBREVIATION_DATAS.put("黑龙江省", "黑龙江");
PROVINCE_ABBREVIATION_DATAS.put("江苏省", "江苏");
PROVINCE_ABBREVIATION_DATAS.put("浙江省", "浙江");
PROVINCE_ABBREVIATION_DATAS.put("安徽省", "安徽");
PROVINCE_ABBREVIATION_DATAS.put("福建省", "福建");
PROVINCE_ABBREVIATION_DATAS.put("江西省", "江西");
PROVINCE_ABBREVIATION_DATAS.put("山东省", "山东");
PROVINCE_ABBREVIATION_DATAS.put("河南省", "河南");
PROVINCE_ABBREVIATION_DATAS.put("湖北省", "湖北");
PROVINCE_ABBREVIATION_DATAS.put("湖南省", "湖南");
PROVINCE_ABBREVIATION_DATAS.put("广东省", "广东");
PROVINCE_ABBREVIATION_DATAS.put("海南省", "海南");
PROVINCE_ABBREVIATION_DATAS.put("四川省", "四川");
PROVINCE_ABBREVIATION_DATAS.put("贵州省", "贵州");
PROVINCE_ABBREVIATION_DATAS.put("云南省", "云南");
PROVINCE_ABBREVIATION_DATAS.put("陕西省", "陕西");
PROVINCE_ABBREVIATION_DATAS.put("甘肃省", "甘肃");
PROVINCE_ABBREVIATION_DATAS.put("青海省", "青海");
PROVINCE_ABBREVIATION_DATAS.put("台湾省", "台湾");
PROVINCE_ABBREVIATION_DATAS.put("内蒙古自治区", "内蒙古");
PROVINCE_ABBREVIATION_DATAS.put("广西壮族自治区", "广西");
PROVINCE_ABBREVIATION_DATAS.put("西藏自治区", "西藏");
PROVINCE_ABBREVIATION_DATAS.put("宁夏回族自治区", "宁夏");
PROVINCE_ABBREVIATION_DATAS.put("新疆维吾尔自治区", "新疆");
PROVINCE_ABBREVIATION_DATAS.put("北京市", "北京");
PROVINCE_ABBREVIATION_DATAS.put("天津市", "天津");
PROVINCE_ABBREVIATION_DATAS.put("上海市", "上海");
PROVINCE_ABBREVIATION_DATAS.put("重庆市", "重庆");
PROVINCE_ABBREVIATION_DATAS.put("香港特别行政区", "香港");
PROVINCE_ABBREVIATION_DATAS.put("澳门特别行政区", "澳门");
}
public static String getAbbreviatedProvince(String name) {
if (PROVINCE_ABBREVIATION_DATAS.containsKey(name)) {
return PROVINCE_ABBREVIATION_DATAS.get(name);
}
return "";
}
}

39
src/main/java/com/fr/plugin/third/party/jsdibgd/UIComboBoxWithNone.java

@ -0,0 +1,39 @@
package com.fr.plugin.third.party.jsdibgd;
import com.fanruan.api.design.ui.component.UIComboBox;
import com.fr.design.i18n.Toolkit;
import java.util.List;
public class UIComboBoxWithNone extends UIComboBox {
protected String getDefaultLocaleString() {
return Toolkit.i18nText("Fine-Design_Chart_Use_None");
}
public UIComboBoxWithNone() {
this.addDefaultItem();
}
public void refreshBoxItems(List var1) {
super.refreshBoxItems(var1);
this.addDefaultItem();
}
public void clearBoxItems() {
super.clearBoxItems();
this.addDefaultItem();
}
private void addDefaultItem() {
this.addItem(this.getDefaultLocaleString());
}
public void setSelectedItem(Object var1) {
super.setSelectedItem(var1);
if (this.getSelectedIndex() == -1) {
super.setSelectedItem(this.getDefaultLocaleString());
}
}
}

197
src/main/java/com/fr/plugin/third/party/jsdibgd/color/ColorUtils.java

@ -0,0 +1,197 @@
package com.fr.plugin.third.party.jsdibgd.color;
import java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ColorUtils {
/**
* 颜色变暗
*
* @param color
* @return
*/
public static Color toDark(Color color) {
if (color == null) {
return Color.black;
}
float[] hsb = rgb2hsb(color.getRed(), color.getGreen(), color.getBlue());
float h = hsb[0];
float s = hsb[1];
float b = hsb[2];
if (s >= 0.5) {
s = (float) (s - 0.5);
} else {
s = 0;
}
int[] rgb = hsb2rgb(h, s, b);
Color tempColor = new Color(rgb[0], rgb[2], rgb[2]);
return tempColor;
}
public static float[] rgb2hsb(int rgbR, int rgbG, int rgbB) {
assert 0 <= rgbR && rgbR <= 255;
assert 0 <= rgbG && rgbG <= 255;
assert 0 <= rgbB && rgbB <= 255;
int[] rgb = new int[]{rgbR, rgbG, rgbB};
Arrays.sort(rgb);
int max = rgb[2];
int min = rgb[0];
float hsbB = max / 255.0f;
float hsbS = max == 0 ? 0 : (max - min) / (float) max;
float hsbH = 0;
if (max == rgbR && rgbG >= rgbB) {
hsbH = (rgbG - rgbB) * 60f / (max - min) + 0;
} else if (max == rgbR && rgbG < rgbB) {
hsbH = (rgbG - rgbB) * 60f / (max - min) + 360;
} else if (max == rgbG) {
hsbH = (rgbB - rgbR) * 60f / (max - min) + 120;
} else if (max == rgbB) {
hsbH = (rgbR - rgbG) * 60f / (max - min) + 240;
}
return new float[]{hsbH, hsbS, hsbB};
}
public static int[] hsb2rgb(float h, float s, float v) {
assert Float.compare(h, 0.0f) >= 0 && Float.compare(h, 360.0f) <= 0;
assert Float.compare(s, 0.0f) >= 0 && Float.compare(s, 1.0f) <= 0;
assert Float.compare(v, 0.0f) >= 0 && Float.compare(v, 1.0f) <= 0;
float r = 0, g = 0, b = 0;
int i = (int) ((h / 60) % 6);
float f = (h / 60) - i;
float p = v * (1 - s);
float q = v * (1 - f * s);
float t = v * (1 - (1 - f) * s);
switch (i) {
case 0:
r = v;
g = t;
b = p;
break;
case 1:
r = q;
g = v;
b = p;
break;
case 2:
r = p;
g = v;
b = t;
break;
case 3:
r = p;
g = q;
b = v;
break;
case 4:
r = t;
g = p;
b = v;
break;
case 5:
r = v;
g = p;
b = q;
break;
default:
break;
}
return new int[]{(int) (r * 255.0), (int) (g * 255.0),
(int) (b * 255.0)};
}
/**
* 获取渐变颜色 当前颜色到 红绿蓝 渐变
*
* @param color
* @param count
* @return
*/
public static List<Color> getGradientColors(Color color, int count) {
List<Color> colors = new ArrayList<>();
if (count <= 0) {
return colors;
}
if (count <= 1) {
count = 1;
}
int max = count - 1;
if (color == null) {
for (int i = 0; i <= max; i++) {
colors.add(Color.black);
}
return colors;
}
if (count == 1) {
colors.add(color);
return colors;
}
Color endColor = new Color(220, 220, 220);
endColor = Color.RED;
int maxStep = Math.abs(Math.abs(color.getRGB()) - Math.abs(endColor.getRGB()));
int tempStep = Math.abs(Math.abs(color.getRGB()) - Math.abs(Color.GREEN.getRGB()));
if (tempStep >= maxStep) {
maxStep = tempStep;
endColor = Color.GREEN;
}
tempStep = Math.abs(Math.abs(color.getRGB()) - Math.abs(Color.BLUE.getRGB()));
if (tempStep >= maxStep) {
maxStep = tempStep;
endColor = Color.BLUE;
}
endColor = new Color(220, 220, 220);
double redStep = (endColor.getRed() - color.getRed()) / (count + 1);
double greenStep = (endColor.getGreen() - color.getGreen()) / (count + 1);
double blueStep = (endColor.getBlue() - color.getBlue()) / (count + 1);
int redValue = color.getRed();
int greenValue = color.getGreen();
int blueValue = color.getBlue();
double redTempValue = color.getRed();
double greenTempValue = color.getGreen();
double blueTempValue = color.getBlue();
Color tempColor = null;
for (int i = 0; i <= max; i++) {
if (redValue >= 255) {
redValue = 255;
}
if (greenValue >= 255) {
greenValue = 255;
}
if (blueValue >= 255) {
blueValue = 255;
}
tempColor = new Color(redValue, greenValue, blueValue);
colors.add(tempColor);
redTempValue = (redTempValue + redStep);
greenTempValue = (greenTempValue + greenStep);
blueTempValue = (blueTempValue + blueStep);
redValue = (int) redTempValue;
greenValue = (int) greenTempValue;
blueValue = (int) blueTempValue;
}
return colors;
}
public static String rgbToHex(Color color) {
if (color == null) {
return "#000000";
}
String value = "#" + String.format("%02X", color.getRed()) + String.format("%02X", color.getGreen()) + String.format("%02X", color.getBlue());
return value;
}
}

89
src/main/java/com/fr/plugin/third/party/jsdibgd/data/DataCellFieldsPane.java

@ -0,0 +1,89 @@
package com.fr.plugin.third.party.jsdibgd.data;
import com.fanruan.api.design.chart.field.BaseCellDataFieldsPane;
import com.fanruan.api.design.ui.component.formula.UIFormulaTextField;
import java.awt.*;
public class DataCellFieldsPane extends BaseCellDataFieldsPane<DataColumnFieldCollection> {
private UIFormulaTextField areaPane;
private UIFormulaTextField deptNamePane;
private UIFormulaTextField outputValuePane;
private UIFormulaTextField profitPane;
private UIFormulaTextField cashFlowPane;
private UIFormulaTextField newContractPane;
private UIFormulaTextField longitudePane;
private UIFormulaTextField latitudePane;
public void initComponents() {
areaPane = new UIFormulaTextField();
deptNamePane = new UIFormulaTextField();
outputValuePane = new UIFormulaTextField();
profitPane = new UIFormulaTextField();
cashFlowPane = new UIFormulaTextField();
newContractPane = new UIFormulaTextField();
longitudePane = new UIFormulaTextField();
latitudePane = new UIFormulaTextField();
super.initComponents();
}
@Override
protected String[] fieldLabels() {
return DataColumnFieldCollection.FIELD_LABELS;
}
@Override
protected Component[] fieldComponents() {
return new Component[]{
this.areaPane,
this.deptNamePane,
this.outputValuePane,
this.profitPane,
this.cashFlowPane,
this.newContractPane,
this.longitudePane,
this.latitudePane,
};
}
@Override
protected UIFormulaTextField[] formulaPanes() {
return new UIFormulaTextField[]{
this.areaPane,
this.deptNamePane,
this.outputValuePane,
this.profitPane,
this.cashFlowPane,
this.newContractPane,
this.longitudePane,
this.latitudePane,
};
}
@Override
public void populateBean(DataColumnFieldCollection dataConf) {
populateField(areaPane, dataConf.getAreaName());
populateField(deptNamePane, dataConf.getDeptName());
populateField(outputValuePane, dataConf.getOutputValue());
populateField(profitPane, dataConf.getProfit());
populateField(cashFlowPane, dataConf.getCashFlow());
populateField(newContractPane, dataConf.getNewContract());
populateField(longitudePane, dataConf.getLongitude());
populateField(latitudePane, dataConf.getLatitude());
}
@Override
public DataColumnFieldCollection updateBean() {
DataColumnFieldCollection dataConf = new DataColumnFieldCollection();
updateField(areaPane, dataConf.getAreaName());
updateField(deptNamePane, dataConf.getDeptName());
updateField(outputValuePane, dataConf.getOutputValue());
updateField(profitPane, dataConf.getProfit());
updateField(cashFlowPane, dataConf.getCashFlow());
updateField(newContractPane, dataConf.getNewContract());
updateField(longitudePane, dataConf.getLongitude());
updateField(latitudePane, dataConf.getLatitude());
return dataConf;
}
}

129
src/main/java/com/fr/plugin/third/party/jsdibgd/data/DataColumnFieldCollection.java

@ -0,0 +1,129 @@
package com.fr.plugin.third.party.jsdibgd.data;
import com.fanruan.api.report.chart.field.BaseColumnFieldCollection;
import com.fr.chartx.data.field.ColumnField;
public class DataColumnFieldCollection extends BaseColumnFieldCollection {
public static String[] FIELD_LABELS = new String[]{
"省份",
"部门",
"产值",
"利润",
"现金流",
"新签合同",
"经度",
"纬度",
};
/**
* 省份
*/
private ColumnField areaName = new ColumnField();
/**
* 部门名称
*/
private ColumnField deptName = new ColumnField();
/**
* 产值
*/
private ColumnField outputValue = new ColumnField();
/**
* 利润
*/
private ColumnField profit = new ColumnField();
/**
* 现金流
*/
private ColumnField cashFlow = new ColumnField();
/**
* 新签合同
*/
private ColumnField newContract = new ColumnField();
/**
* 经度
*/
private ColumnField longitude = new ColumnField();
/**
* 纬度
*/
private ColumnField latitude = new ColumnField();
public ColumnField getAreaName() {
return areaName;
}
public void setAreaName(ColumnField areaName) {
this.areaName = areaName;
}
public ColumnField getLongitude() {
return longitude;
}
public void setLongitude(ColumnField longitude) {
this.longitude = longitude;
}
public ColumnField getLatitude() {
return latitude;
}
public void setLatitude(ColumnField latitude) {
this.latitude = latitude;
}
public ColumnField getDeptName() {
return deptName;
}
public void setDeptName(ColumnField deptName) {
this.deptName = deptName;
}
public ColumnField getOutputValue() {
return outputValue;
}
public void setOutputValue(ColumnField outputValue) {
this.outputValue = outputValue;
}
public ColumnField getProfit() {
return profit;
}
public void setProfit(ColumnField profit) {
this.profit = profit;
}
public ColumnField getCashFlow() {
return cashFlow;
}
public void setCashFlow(ColumnField cashFlow) {
this.cashFlow = cashFlow;
}
public ColumnField getNewContract() {
return newContract;
}
public void setNewContract(ColumnField newContract) {
this.newContract = newContract;
}
}

93
src/main/java/com/fr/plugin/third/party/jsdibgd/data/DataSetFieldsPane.java

@ -0,0 +1,93 @@
package com.fr.plugin.third.party.jsdibgd.data;
import com.fanruan.api.design.chart.field.BaseDataSetFieldsPane;
import com.fanruan.api.design.ui.component.UIComboBox;
import com.fr.plugin.third.party.jsdibgd.UIComboBoxWithNone;
import java.awt.*;
public class DataSetFieldsPane extends BaseDataSetFieldsPane<DataColumnFieldCollection> {
private UIComboBoxWithNone areaPane;
private UIComboBoxWithNone deptNamePane;
private UIComboBoxWithNone outputValuePane;
private UIComboBoxWithNone profitPane;
private UIComboBoxWithNone cashFlowPane;
private UIComboBoxWithNone newContractPane;
private UIComboBoxWithNone longitudePane;
private UIComboBoxWithNone latitudePane;
public void initComponents() {
areaPane = new UIComboBoxWithNone();
deptNamePane = new UIComboBoxWithNone();
outputValuePane = new UIComboBoxWithNone();
profitPane = new UIComboBoxWithNone();
cashFlowPane = new UIComboBoxWithNone();
newContractPane = new UIComboBoxWithNone();
longitudePane = new UIComboBoxWithNone();
latitudePane = new UIComboBoxWithNone();
super.initComponents();
}
@Override
protected String[] fieldLabels() {
return DataColumnFieldCollection.FIELD_LABELS;
}
@Override
protected Component[] fieldComponents() {
return new Component[]{
this.areaPane,
this.deptNamePane,
this.outputValuePane,
this.profitPane,
this.cashFlowPane,
this.newContractPane,
this.longitudePane,
this.latitudePane,
};
}
@Override
protected UIComboBox[] filedComboBoxes() {
return new UIComboBox[]{
this.areaPane,
this.deptNamePane,
this.outputValuePane,
this.profitPane,
this.cashFlowPane,
this.newContractPane,
this.longitudePane,
this.latitudePane,
};
}
@Override
public void populateBean(DataColumnFieldCollection dataConf) {
populateField(areaPane, dataConf.getAreaName());
populateField(deptNamePane, dataConf.getDeptName());
populateField(outputValuePane, dataConf.getOutputValue());
populateField(profitPane, dataConf.getProfit());
populateField(cashFlowPane, dataConf.getCashFlow());
populateField(newContractPane, dataConf.getNewContract());
populateField(longitudePane, dataConf.getLongitude());
populateField(latitudePane, dataConf.getLatitude());
}
@Override
public DataColumnFieldCollection updateBean() {
DataColumnFieldCollection dataConf = new DataColumnFieldCollection();
updateField(areaPane, dataConf.getAreaName());
updateField(deptNamePane, dataConf.getDeptName());
updateField(outputValuePane, dataConf.getOutputValue());
updateField(profitPane, dataConf.getProfit());
updateField(cashFlowPane, dataConf.getCashFlow());
updateField(newContractPane, dataConf.getNewContract());
updateField(longitudePane, dataConf.getLongitude());
updateField(latitudePane, dataConf.getLatitude());
return dataConf;
}
}

59
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/ColorSectionPane.java

@ -0,0 +1,59 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fr.chart.chartglyph.MapHotAreaColor;
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.van.chart.range.component.SectionIntervalConfigPaneWithOutNum;
import javax.swing.*;
public class ColorSectionPane extends AbstractAttrNoScrollPane implements UIObserver {
private SectionIntervalConfigPaneWithOutNum sectionIntervalConfigPaneWithOutNum;
protected UIObserverListener uiObserverListener;
public ColorSectionPane() {
if (this.shouldResponseChangeListener()) {
addAttributeChangeListener(new AttributeChangeListener() {
@Override
public void attributeChange() {
if (ColorSectionPane.this.uiObserverListener != null) {
ColorSectionPane.this.uiObserverListener.doChange();
}
}
});
}
}
@Override
protected JPanel createContentPane() {
sectionIntervalConfigPaneWithOutNum = new SectionIntervalConfigPaneWithOutNum(this);
return sectionIntervalConfigPaneWithOutNum;
}
public void updateBean(MapHotAreaColor mapHotAreaColor) {
sectionIntervalConfigPaneWithOutNum.updateBean(mapHotAreaColor);
}
public void populateBean(MapHotAreaColor mapHotAreaColor) {
sectionIntervalConfigPaneWithOutNum.populateBean(mapHotAreaColor);
}
public String title4PopupWindow() {
return "区域颜色设置";
}
@Override
public void registerChangeListener(UIObserverListener uiObserverListener) {
this.uiObserverListener = uiObserverListener;
}
@Override
public boolean shouldResponseChangeListener() {
return true;
}
}

251
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/ColorSeriesConfPane.java

@ -0,0 +1,251 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fr.base.BaseUtils;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;
public class ColorSeriesConfPane extends BasicPane {
private JList colorList;
private UIButton addButton;
private UIButton editButton;
private UIButton removeButton;
private UIButton moveUpButton;
private UIButton moveDownButton;
ActionListener addActionListener = new ActionListener() {
public void actionPerformed(ActionEvent var1) {
final ColorSettingPane var2 = new ColorSettingPane();
BasicDialog var3 = var2.showSmallWindow(SwingUtilities.getWindowAncestor(ColorSeriesConfPane.this), new DialogActionAdapter() {
public void doOk() {
Color var1 = var2.update();
if (var1 != null) {
DefaultListModel var2x = (DefaultListModel) ColorSeriesConfPane.this.colorList.getModel();
var2x.addElement(var1);
ColorSeriesConfPane.this.colorList.setSelectedIndex(var2x.size() - 1);
}
}
});
var3.setTitle("增加颜色...");
var3.setVisible(true);
}
};
ActionListener editActionListener = new ActionListener() {
public void actionPerformed(ActionEvent var1) {
ColorSeriesConfPane.this.editPrinterList();
}
};
ActionListener removeActionListener = new ActionListener() {
public void actionPerformed(ActionEvent var1) {
int var2 = ColorSeriesConfPane.this.colorList.getSelectedIndex();
if (var2 != -1) {
int var3 = FineJOptionPane.showConfirmDialog(ColorSeriesConfPane.this, "你确实想删除选中的颜色吗?", Toolkit.i18nText("Fine-Design_Basic_Remove"), 2, 3);
if (var3 == 0) {
((DefaultListModel) ColorSeriesConfPane.this.colorList.getModel()).remove(var2);
if (ColorSeriesConfPane.this.colorList.getModel().getSize() > 0) {
if (var2 < ColorSeriesConfPane.this.colorList.getModel().getSize()) {
ColorSeriesConfPane.this.colorList.setSelectedIndex(var2);
} else {
ColorSeriesConfPane.this.colorList.setSelectedIndex(ColorSeriesConfPane.this.colorList.getModel().getSize() - 1);
}
}
ColorSeriesConfPane.this.checkButtonEnabled();
}
}
}
};
ActionListener moveUpActionListener = new ActionListener() {
public void actionPerformed(ActionEvent var1) {
int var2 = ColorSeriesConfPane.this.colorList.getSelectedIndex();
if (var2 > 0) {
DefaultListModel var3 = (DefaultListModel) ColorSeriesConfPane.this.colorList.getModel();
Object var4 = var3.get(var2 - 1);
var3.set(var2 - 1, var3.get(var2));
var3.set(var2, var4);
ColorSeriesConfPane.this.colorList.setSelectedIndex(var2 - 1);
ColorSeriesConfPane.this.checkButtonEnabled();
}
}
};
ActionListener moveDownActionListener = new ActionListener() {
public void actionPerformed(ActionEvent var1) {
int var2 = ColorSeriesConfPane.this.colorList.getSelectedIndex();
if (var2 != -1) {
if (var2 < ColorSeriesConfPane.this.colorList.getModel().getSize() - 1) {
DefaultListModel var3 = (DefaultListModel) ColorSeriesConfPane.this.colorList.getModel();
Object var4 = var3.get(var2 + 1);
var3.set(var2 + 1, var3.get(var2));
var3.set(var2, var4);
ColorSeriesConfPane.this.colorList.setSelectedIndex(var2 + 1);
ColorSeriesConfPane.this.checkButtonEnabled();
}
}
}
};
ListSelectionListener printerSelectionListener = new ListSelectionListener() {
public void valueChanged(ListSelectionEvent var1) {
ColorSeriesConfPane.this.checkButtonEnabled();
}
};
MouseAdapter mouseClickedListener = new MouseAdapter() {
public void mouseClicked(MouseEvent var1) {
int var2 = var1.getClickCount();
if (var2 >= 2) {
ColorSeriesConfPane.this.editPrinterList();
}
}
};
public class ColorRenderer extends JLabel implements ListCellRenderer {
@Override
public Component getListCellRendererComponent(JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
if ((value != null) && (value instanceof Color)) {
Color color = (Color) value;
this.setOpaque(true); //此句是重点,设置背景颜色必须先将它设置为不透明的,因为默认是透明的。。。
this.setText(" ");
this.setBackground(color);
}
return this;
}
}
public ColorSeriesConfPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(6, 2, 4, 2));
JToolBar var1 = new JToolBar();
this.add(var1, "North");
Dimension var2 = new Dimension(24, 24);
this.addButton = new UIButton(BaseUtils.readIcon("/com/fr/base/images/cell/control/add.png"));
this.addButton.addActionListener(this.addActionListener);
this.addButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Add"));
this.addButton.setPreferredSize(var2);
this.editButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/edit.png"));
this.editButton.addActionListener(this.editActionListener);
this.editButton.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Edit"));
this.editButton.setPreferredSize(var2);
this.removeButton = new UIButton(BaseUtils.readIcon("/com/fr/base/images/cell/control/remove.png"));
this.removeButton.addActionListener(this.removeActionListener);
this.removeButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Remove"));
this.removeButton.setPreferredSize(var2);
this.moveUpButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/up.png"));
this.moveUpButton.addActionListener(this.moveUpActionListener);
this.moveUpButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Up"));
this.moveUpButton.setPreferredSize(var2);
this.moveDownButton = new UIButton(BaseUtils.readIcon("/com/fr/design/images/control/down.png"));
this.moveDownButton.addActionListener(this.moveDownActionListener);
this.moveDownButton.setToolTipText(Toolkit.i18nText("Fine-Design_Basic_Utils_Move_Down"));
this.moveDownButton.setPreferredSize(var2);
var1.add(this.addButton);
var1.add(this.editButton);
var1.add(this.removeButton);
var1.add(this.moveUpButton);
var1.add(this.moveDownButton);
this.colorList = new JList(new DefaultListModel());
this.colorList.addListSelectionListener(this.printerSelectionListener);
this.colorList.addMouseListener(this.mouseClickedListener);
this.colorList.setCellRenderer(new ColorRenderer());
this.add(new JScrollPane(this.colorList), "Center");
this.checkButtonEnabled();
}
protected String title4PopupWindow() {
return "完成颜色设置";
}
private void checkButtonEnabled() {
this.editButton.setEnabled(false);
this.removeButton.setEnabled(false);
this.moveUpButton.setEnabled(false);
this.moveDownButton.setEnabled(false);
int var1 = this.colorList.getSelectedIndex();
if (var1 >= 0) {
this.editButton.setEnabled(true);
this.removeButton.setEnabled(true);
if (var1 > 0) {
this.moveUpButton.setEnabled(true);
}
if (var1 < this.colorList.getModel().getSize() - 1) {
this.moveDownButton.setEnabled(true);
}
}
}
public void editPrinterList() {
final int var1 = this.colorList.getSelectedIndex();
final ColorSettingPane var2 = new ColorSettingPane();
BasicDialog var3 = var2.showSmallWindow(SwingUtilities.getWindowAncestor(this), new DialogActionAdapter() {
public void doOk() {
Color var1x = var2.update();
if (var1x != null) {
DefaultListModel var2x = (DefaultListModel) ColorSeriesConfPane.this.colorList.getModel();
var2x.remove(var1);
var2x.add(var1, var1x);
ColorSeriesConfPane.this.colorList.setSelectedIndex(var1);
}
}
});
var2.populate((Color) this.colorList.getSelectedValue());
var3.setTitle( "编辑颜色...");
var3.setVisible(true);
}
public void populate(List<Integer> colors) {
DefaultListModel var3 = (DefaultListModel) this.colorList.getModel();
var3.removeAllElements();
if ((colors == null) || (colors.size() <= 0)) {
return;
}
int size = colors.size();
for (int i = 0, max = size - 1; i <= max; i++) {
var3.addElement(new Color(colors.get(i)));
}
if (size >= 1) {
this.colorList.setSelectedIndex(0);
}
}
public List update() {
List<Integer> var2 = new ArrayList();
DefaultListModel var3 = (DefaultListModel) this.colorList.getModel();
Color color;
for (int i = 0, max = var3.size() - 1; i <= max; i++) {
color = (Color) var3.get(i);
var2.add(color.getRGB());
}
return var2;
}
}

46
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/ColorSettingPane.java

@ -0,0 +1,46 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fanruan.api.design.ui.component.UILabel;
import com.fr.design.dialog.BasicPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.style.color.NewColorSelectBox;
import java.awt.*;
public class ColorSettingPane extends BasicPane {
//private ColorBackgroundQuickPane colorBackgroundQuickPane;
private NewColorSelectBox colorBackgroundQuickPane;
public ColorSettingPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
colorBackgroundQuickPane = new NewColorSelectBox(100);
this.add(new UILabel("设置颜色"), BorderLayout.NORTH);
this.add(colorBackgroundQuickPane, BorderLayout.CENTER);
}
public void checkValid() throws Exception {
}
protected boolean isShowHelpButton() {
return false;
}
protected String title4PopupWindow() {
return "设置颜色";
}
public void populate(Color var1) {
//this.colorBackgroundQuickPane.populateColor(var1);
this.colorBackgroundQuickPane.setSelectObject(var1);
}
public Color update() {
//return this.colorBackgroundQuickPane.updateColor();
return this.colorBackgroundQuickPane.getSelectObject();
}
}

461
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CustomFRFontPane.java

@ -0,0 +1,461 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fanruan.api.design.DesignKit;
import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.base.Style;
import com.fr.base.Utils;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.constants.UIConstants;
import com.fr.design.event.GlobalNameListener;
import com.fr.design.event.GlobalNameObserver;
import com.fr.design.gui.ibutton.UIColorButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.design.gui.icombobox.LineComboBox;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.style.AbstractBasicStylePane;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.DefaultValues;
import com.fr.general.FRFont;
import com.fr.stable.Constants;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Vector;
/**
* Pane to edit Font.
*/
public class CustomFRFontPane extends AbstractBasicStylePane implements GlobalNameObserver {
public static final Integer[] FONT_SIZES = {
6, 8, 9, 10, 11, 12, 13, 14, 16,
18, 20, 22, 24, 26, 28, 30, 32, 34,
36, 38, 40, 48, 64, 72, 128
};
private static final int MAX_FONT_SIZE = 100;
private static final Dimension BUTTON_SIZE = new Dimension(20, 18);
private static final Dimension UNDER_LINE_SIZE = new Dimension(87, 20);
private static final Dimension HIDE_SIZE = new Dimension(0, 0);
private final String[] fontSizeStyles = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Plain"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Bold"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Italic"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Bolditalic")};
private JPanel buttonPane;
private JPanel isSuperOrSubPane;
private UIComboBox fontNameComboBox;
private UIComboBox fontSizeStyleComboBox;
protected UIComboBox fontSizeComboBox;
private UIToggleButton bold;
private UIToggleButton italic;
private UIToggleButton underline;
private GlobalNameListener globalNameListener = null;
// underline
private LineComboBox underlineCombo;
private UIColorButton colorSelectPane;
// effects.
private UIToggleButton isStrikethroughCheckBox;
private UIToggleButton isShadowCheckBox;
private UIToggleButton superPane;
private UIToggleButton subPane;
private JPanel linePane;
private int italic_bold;
private String title = DesignKit.i18nText("Fine-Design_Report_Sytle_FRFont");
;
/**
* LeftPane和RightPane之间的间隙也是fontSizeStyleComboBox与fontSizeComboBox之间的间隙之前的默认值为VGAP_LARGE
*/
private int hGapBetweenLeftPaneAndRightPane = LayoutConstants.VGAP_LARGE;
public CustomFRFontPane(String text) {
this.title = text;
this.initComponents();
}
public CustomFRFontPane() {
this.initComponents();
}
public CustomFRFontPane(int hGapBetweenLeftPaneAndRightPane) {
this.hGapBetweenLeftPaneAndRightPane = hGapBetweenLeftPaneAndRightPane;
this.initComponents();
}
public static void main(String[] args) {
JFrame jf = new JFrame("test");
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel content = (JPanel) jf.getContentPane();
content.setLayout(new BorderLayout());
content.add(new CustomFRFontPane(), BorderLayout.CENTER);
GUICoreUtils.centerWindow(jf);
jf.setSize(290, 400);
jf.setVisible(true);
}
@Override
protected String title4PopupWindow() {
return this.title;
}
/**
* Use font to populate pane.
*/
public void populateBean(FRFont frFont) {
fontNameComboBox.setSelectedItem(frFont.getFamily());
fontSizeStyleComboBox.setSelectedIndex(frFont.getStyle());
fontSizeComboBox.setSelectedItem(Utils.round5(frFont.getSize2D()));
bold.setSelected(frFont.isBold());
italic.setSelected(frFont.isItalic());
// foreground.
this.colorSelectPane.setColor(frFont.getForeground());
this.colorSelectPane.repaint();
// update frFont.
CardLayout cly = (CardLayout) linePane.getLayout();
int line = frFont.getUnderline();
if (line == Constants.LINE_NONE) {
underline.setSelected(false);
cly.show(linePane, "none");
linePane.setPreferredSize(HIDE_SIZE);
} else {
underline.setSelected(true);
cly.show(linePane, "combobox");
linePane.setPreferredSize(UNDER_LINE_SIZE);
this.underlineCombo.setSelectedLineStyle(line);
}
// effects
this.isStrikethroughCheckBox.setSelected(frFont.isStrikethrough());
this.isShadowCheckBox.setSelected(frFont.isShadow());
if (frFont.isSuperscript()) {
this.superPane.setSelected(true);
this.subPane.setSelected(false);
} else if (frFont.isSubscript()) {
this.superPane.setSelected(false);
this.subPane.setSelected(true);
} else {
this.superPane.setSelected(false);
this.subPane.setSelected(false);
}
}
public FRFont updateFRFont() {
FRFont frFont = FRFont.getInstance();
frFont = frFont.applyName((String) fontNameComboBox.getSelectedItem());
frFont = frFont.applyStyle(fontSizeStyleComboBox.getSelectedIndex());
frFont = frFont.applySize(Float.parseFloat(fontSizeComboBox.getSelectedItem().toString()));
frFont = frFont.applyForeground(this.colorSelectPane.getColor());
int line = underline.isSelected() ? this.underlineCombo.getSelectedLineStyle() : Constants.LINE_NONE;
frFont = frFont.applyUnderline(line);
frFont = frFont.applyUnderline(this.underlineCombo.getSelectedLineStyle());
frFont = frFont.applyStrikethrough(isStrikethroughCheckBox.isSelected());
frFont = frFont.applyShadow(isShadowCheckBox.isSelected());
frFont = updateOthers(frFont);
return frFont;
}
/**
* Update pane to get new font.
*/
public FRFont update(FRFont frFont) {
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name"))) {
frFont = frFont.applyName((String) fontNameComboBox.getSelectedItem());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Style"))) {
frFont = frFont.applyStyle(fontSizeStyleComboBox.getSelectedIndex());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Size"))) {
frFont = frFont.applySize(Float.parseFloat(fontSizeComboBox.getSelectedItem().toString()));
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Foreground"))) {
frFont = frFont.applyForeground(this.colorSelectPane.getColor());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Underline"))) {
int line = underline.isSelected() ? this.underlineCombo.getSelectedLineStyle() : Constants.LINE_NONE;
frFont = frFont.applyUnderline(line);
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style"))) {
frFont = frFont.applyUnderline(this.underlineCombo.getSelectedLineStyle());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Strikethrough"))) {
frFont = frFont.applyStrikethrough(isStrikethroughCheckBox.isSelected());
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Shadow"))) {
frFont = frFont.applyShadow(isShadowCheckBox.isSelected());
}
frFont = updateOthers(frFont);
return frFont;
}
private FRFont updateOthers(FRFont frFont) {
frFont = updateSubSuperscript(frFont);
return frFont;
}
private FRFont updateSubSuperscript(FRFont frFont) {
boolean isSuper = frFont.isSuperscript();
boolean isSub = frFont.isSubscript();
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Superscript"))) {
//如果上标没有选中,点击则选中上标,并且下标一定是不选中状态
//如果上标选中,点击则取消选中上标,字体回复正常
if (superPane.isSelected() && !isSuper) {
frFont = frFont.applySuperscript(true);
frFont = frFont.applySubscript(false);
this.subPane.setSelected(false);
} else if (!superPane.isSelected() && isSuper) {
frFont = frFont.applySuperscript(false);
}
}
if (ComparatorUtils.equals(globalNameListener.getGlobalName(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Subscript"))) {
if (subPane.isSelected() && !isSub) {
frFont = frFont.applySubscript(true);
frFont = frFont.applySuperscript(false);
this.superPane.setSelected(false);
} else if (!subPane.isSelected() && isSub) {
frFont = frFont.applySubscript(false);
}
}
return frFont;
}
@Override
public void populateBean(Style style) {
this.populateBean(style.getFRFont());
}
@Override
public Style update(Style style) {
// TODO Auto-generated method stub
FRFont frFont = style.getFRFont();
frFont = this.update(frFont);
return style.deriveFRFont(frFont);
}
public static Vector<Integer> getFontSizes() {
Vector<Integer> FONT_SIZES = new Vector<Integer>();
for (int i = 1; i < MAX_FONT_SIZE; i++) {
FONT_SIZES.add(i);
}
return FONT_SIZES;
}
protected void initComponents() {
fontSizeStyleComboBox = new UIComboBox(fontSizeStyles);
fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report());
fontNameComboBox.setPreferredSize(new Dimension(144, 20));
fontSizeComboBox = new UIComboBox(getFontSizes());
fontSizeComboBox.setEditable(true);
this.underlineCombo = new LineComboBox(UIConstants.BORDER_LINE_STYLE_ARRAY);
colorSelectPane = new UIColorButton();
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"));
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png"));
underline = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png"));
bold.setPreferredSize(BUTTON_SIZE);
italic.setPreferredSize(BUTTON_SIZE);
underline.setPreferredSize(BUTTON_SIZE);
isStrikethroughCheckBox = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/strikethrough.png"));
isStrikethroughCheckBox.setPreferredSize(BUTTON_SIZE);
isShadowCheckBox = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/shadow.png"));
isShadowCheckBox.setPreferredSize(BUTTON_SIZE);
superPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sup.png"));
superPane.setPreferredSize(BUTTON_SIZE);
subPane = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/sub.png"));
subPane.setPreferredSize(BUTTON_SIZE);
Component[] SuperOrSubComponents = new Component[]{
superPane, subPane
};
isSuperOrSubPane = new JPanel(new BorderLayout());
isSuperOrSubPane.add(GUICoreUtils.createFlowPane(SuperOrSubComponents, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL));
Component[] components_font = new Component[]{
colorSelectPane, underline, isStrikethroughCheckBox, isShadowCheckBox
};
buttonPane = new JPanel(new BorderLayout());
buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL));
linePane = new JPanel(new CardLayout());
initAllNames();
setToolTips();
this.setLayout(new BorderLayout());
this.add(createPane(), BorderLayout.CENTER);
DefaultValues defaultValues = FRContext.getDefaultValues();
populateBean(defaultValues.getFRFont());
}
private void initAllNames() {
fontSizeStyleComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Style"));
fontNameComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name"));
fontSizeComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Size"));
colorSelectPane.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Foreground"));
italic.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Italic"));
bold.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Bold"));
underline.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Underline"));
underlineCombo.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Line_Style"));
isStrikethroughCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Strikethrough"));
isShadowCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Shadow"));
superPane.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Superscript"));
subPane.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Subscript"));
}
private void setToolTips() {
colorSelectPane.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Foreground"));
italic.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Italic"));
bold.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Bold"));
underline.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Underline"));
isStrikethroughCheckBox.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Strikethrough"));
isShadowCheckBox.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Shadow"));
superPane.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Superscript"));
subPane.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_FR_Font_Subscript"));
}
private JPanel createLinePane() {
linePane.add(new JPanel(), "none");
JPanel gap = new JPanel(new GridLayout(0, 1));
gap.add(underlineCombo);
linePane.add(gap, "combobox");
underline.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
CardLayout cly = (CardLayout) linePane.getLayout();
cly.show(linePane, underline.isSelected() ? "combobox" : "none");
if (underline.isSelected()) {
linePane.setPreferredSize(UNDER_LINE_SIZE);
} else {
linePane.setPreferredSize(HIDE_SIZE);
}
}
});
return linePane;
}
private JPanel createLeftPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p};
double[] rowSize = {p, p, p};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{fontSizeStyleComboBox},
new Component[]{buttonPane},
new Component[]{createLinePane()}
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
protected JPanel createRightPane() {
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {f};
double[] rowSize = {p, p};
int[][] rowCount = {{1, 1}, {1, 1}};
Component[][] components = new Component[][]{
new Component[]{fontSizeComboBox},
new Component[]{isSuperOrSubPane}
};
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
}
private JPanel createPane() {
JPanel createPane = new JPanel(new BorderLayout());
Component[] components_font = new Component[]{
fontNameComboBox, fontSizeComboBox, colorSelectPane
};
createPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL));
//createPane.add(fontNameComboBox, BorderLayout.NORTH);
//JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{createLeftPane(), createRightPane()}}, TableLayoutHelper.FILL_LASTCOLUMN, hGapBetweenLeftPaneAndRightPane, LayoutConstants.VGAP_LARGE);
//jPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
//createPane.add(jPanel, BorderLayout.CENTER);
return createPane;
}
/**
* @param listener 观察者监听事件
*/
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
/**
* @return
*/
public boolean shouldResponseNameListener() {
return false;
}
public void setGlobalName(String name) {
}
private class TwoButtonPane extends JPanel {
public UIToggleButton leftButton;
public UIToggleButton rightButton;
public TwoButtonPane(UIToggleButton leftButton, UIToggleButton rightButton) {
this.leftButton = leftButton;
this.rightButton = rightButton;
this.setLayout(new FlowLayout(FlowLayout.LEFT, 1, 0));
this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
initButton(leftButton);
initButton(rightButton);
initListener();
}
private void initListener() {
leftButton.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
rightButton.setSelected(false);
}
});
rightButton.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
leftButton.setSelected(false);
}
});
}
private void initButton(UIToggleButton button) {
button.setRoundBorder(false);
button.setBorderPainted(false);
this.add(button);
}
protected void paintBorder(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(UIConstants.LINE_COLOR);
int buttonX = getComponent(0).getX();
int buttonY = getComponent(0).getY();
int height = getComponent(0).getHeight();
int width = getComponent(0).getWidth();
g.drawLine(buttonX + width, 0, buttonX + width, height);
width += getComponent(1).getWidth();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.drawRoundRect(buttonX - 1, buttonY - 1, width + 2, getHeight() - 1, UIConstants.ARC, UIConstants.ARC);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
}
}
}

49
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CustomGanttTypePane.java

@ -0,0 +1,49 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fanruan.api.design.chart.DefaultTypePane;
import com.fr.plugin.third.party.jsdibgd.CustomChartConfig;
import javax.swing.*;
import java.awt.*;
public class CustomGanttTypePane extends DefaultTypePane<CustomChartConfig> {
//private UIButtonGroup buttonGroup = new UIButtonGroup(new String[]{DesignKit.i18nText("Fine-Plugin_Legend_Right"), DesignKit.i18nText("Fine-Plugin_Legend_Left")});
@Override
protected String[] getTypeIconPath() {
return new String[]{
"com/fr/plugin/third/party/jsdibgd/images/chart_type.png"
};
}
@Override
protected int getSelectIndexInChart(CustomChartConfig chart) {
return 0;
}
@Override
protected void setSelectIndexInChart(CustomChartConfig chart, int index) {
//chart.setPieType(PieType.parseInt(index));
}
@Override
protected Component[][] getPaneComponents(JPanel typePane) {
return new Component[][]{
new Component[]{typePane},
//new Component[]{buttonGroup}
};
}
@Override
public void populateBean(CustomChartConfig ob) {
super.populateBean(ob);
// buttonGroup.setSelectedIndex(StringKit.equals("left", ob.getLegendPosition()) ? 0 : 1);
}
@Override
public void updateBean(CustomChartConfig ob) {
super.updateBean(ob);
// ob.setLegendPosition(buttonGroup.getSelectedIndex() == 0 ? "left" : "right");
}
}

72
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CustomMultiTabPane.java

@ -0,0 +1,72 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UITabGroup;
import javax.swing.*;
import java.awt.*;
import java.util.List;
public abstract class CustomMultiTabPane<T> extends FurtherBasicBeanPane<T> {
private static final long serialVersionUID = 2298609199400393886L;
protected UITabGroup tabPane;
protected String[] NameArray;
protected JPanel centerPane;
protected CardLayout cardLayout = new CardLayout();
protected List<BasicPane> paneList;
protected abstract List<BasicPane> initPaneList();
public abstract void populateBean(T var1);
public abstract void updateBean(T var1);
public int getSelectedIndex() {
return this.tabPane.getSelectedIndex();
}
public CustomMultiTabPane() {
//this.relayoutWhenListChange();
}
public void relayoutWhenListChange() {
this.centerPane = new JPanel(this.cardLayout) {
public Dimension getPreferredSize() {
return getSelectedIndex() == -1 ? super.getPreferredSize() : paneList.get(getSelectedIndex()).getPreferredSize();
}
};
paneList = this.initPaneList();
this.NameArray = new String[this.paneList.size()];
for(int var1 = 0; var1 < this.paneList.size(); ++var1) {
BasicPane var2 = this.paneList.get(var1);
this.NameArray[var1] = var2.getTitle();
this.centerPane.add(var2, this.NameArray[var1]);
}
this.tabPane = new UITabGroup(this.NameArray) {
public void tabChanged(int var1) {
dealWithTabChanged(var1);
}
};
this.tabPane.setSelectedIndex(0);
this.tabPane.tabChanged(0);
this.initLayout();
}
protected void dealWithTabChanged(int var1) {
this.cardLayout.show(this.centerPane, this.NameArray[var1]);
this.tabChanged();
}
protected void tabChanged() {
}
protected void initLayout() {
this.setLayout(new BorderLayout(0, 4));
this.add(this.tabPane, "North");
this.add(this.centerPane, "Center");
}
}

55
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CustomStyleContentPane.java

@ -0,0 +1,55 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fr.design.dialog.BasicPane;
import com.fr.plugin.third.party.jsdibgd.CustomChartConfig;
import java.util.ArrayList;
import java.util.List;
//import com.fr.design.style.FRFontPane;
public class CustomStyleContentPane extends CustomMultiTabPane<CustomChartConfig> {
private CylinderWidthConfPane cylinderWidthConfPane = new CylinderWidthConfPane();
//private CustomFRFontPane customFRFontPane = new CustomFRFontPane("场站字体");
//private LinkageConfPane linkageConfPane = new LinkageConfPane();
@Override
protected List<BasicPane> initPaneList() {
List<BasicPane> tempPaneList = new ArrayList<>();
tempPaneList.add(cylinderWidthConfPane);
//tempPaneList.add(customFRFontPane);
//tempPaneList.add(linkageConfPane);
return tempPaneList;
}
@Override
public void populateBean(CustomChartConfig config) {
cylinderWidthConfPane.populate(config);
//customFRFontPane.populateBean(config.getStationNameFrFont());
//linkageConfPane.populate(config);
}
@Override
public CustomChartConfig updateBean() {
CustomChartConfig config = new CustomChartConfig();
updateBean(config);
return config;
}
@Override
public void updateBean(CustomChartConfig config) {
cylinderWidthConfPane.update(config);
//linkageConfPane.update(config);
//config.setStationNameFrFont(customFRFontPane.updateFRFont());
}
@Override
public boolean accept(Object o) {
return true;
}
@Override
public void reset() {
}
}

33
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CustomStylePane.java

@ -0,0 +1,33 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fanruan.api.design.chart.BaseOtherPane;
import com.fr.plugin.third.party.jsdibgd.CustomChartConfig;
import javax.swing.*;
public class CustomStylePane extends BaseOtherPane<CustomChartConfig> {
private CustomStyleContentPane contentPane;
@Override
protected JPanel createContentPane() {
contentPane = new CustomStyleContentPane();
contentPane.relayoutWhenListChange();
return contentPane;
}
@Override
protected void populate(CustomChartConfig config) {
contentPane.populateBean(config);
}
@Override
protected void update(CustomChartConfig config) {
contentPane.updateBean(config);
}
@Override
public String title4PopupWindow() {
return "样式";
}
}

79
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/CylinderWidthConfPane.java

@ -0,0 +1,79 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fanruan.api.design.ui.component.UILabel;
import com.fanruan.api.design.ui.layout.TableLayoutKit;
import com.fr.design.dialog.BasicPane;
import com.fr.design.style.color.ColorSelectBox;
import com.fr.plugin.third.party.jsdibgd.CustomChartConfig;
import com.fr.plugin.third.party.jsdibgd.ui.spinner.CustomUIBoundSpinner;
import javax.swing.*;
import java.awt.*;
/**
* 柱形宽度配置
*/
public class CylinderWidthConfPane extends BasicPane {
private ColorSelectBox selectedAreaColorColorSelectBox;
private ColorSelectBox positionDynamicColorColorSelectBox;
private CustomUIBoundSpinner mapSymbolSizeBoundSpinner;
private CustomUIBoundSpinner selectSymbolSizeBoundSpinner;
public CylinderWidthConfPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(new BorderLayout());
JPanel panel0 = new JPanel();
panel0.setLayout(new FlowLayout(0, 0, 0));
selectedAreaColorColorSelectBox = new ColorSelectBox(100);
positionDynamicColorColorSelectBox = new ColorSelectBox(100);
mapSymbolSizeBoundSpinner = new CustomUIBoundSpinner(1, 10000, 1, 10);
selectSymbolSizeBoundSpinner = new CustomUIBoundSpinner(1, 10000, 1, 10);
Component[][] components = new Component[][]{
//{new UILabel("选中区域颜色:"), selectedAreaColorColorSelectBox},
//{new UILabel("位置动态颜色:"), positionDynamicColorColorSelectBox},
{new UILabel("图标大小:"), mapSymbolSizeBoundSpinner},
{new UILabel("选中图标大小:"), selectSymbolSizeBoundSpinner},
};
double p = TableLayoutKit.PREFERRED;
double[] rowSize = new double[]{p, p, p, p};
double[] columnSize = new double[]{p, 100};
JPanel settingsUI = TableLayoutKit.createTableLayoutPane(components, rowSize, columnSize);
this.add(settingsUI, BorderLayout.CENTER);
}
protected String title4PopupWindow() {
return "地图设置";
}
public void populate(CustomChartConfig conf) {
selectedAreaColorColorSelectBox.setSelectObject(new Color(conf.getSelectedAreaColor()));
positionDynamicColorColorSelectBox.setSelectObject(new Color(conf.getPositionDynamicColor()));
mapSymbolSizeBoundSpinner.setValue(conf.getMapSymbolSize());
selectSymbolSizeBoundSpinner.setValue(conf.getSelectSymbolSize());
}
public void update(CustomChartConfig conf) {
conf.setSelectedAreaColor(selectedAreaColorColorSelectBox.getSelectObject().getRGB());
conf.setPositionDynamicColor(positionDynamicColorColorSelectBox.getSelectObject().getRGB());
conf.setMapSymbolSize(getIntegerValue(mapSymbolSizeBoundSpinner.getValue()));
conf.setSelectSymbolSize(getIntegerValue(selectSymbolSizeBoundSpinner.getValue()));
}
private int getIntegerValue(double value) {
int tempValue = (int) value;
if (tempValue <= 0) {
tempValue = 0;
}
return tempValue;
}
}

51
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/DisplayScaleConfPane.java

@ -0,0 +1,51 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fanruan.api.design.ui.component.UILabel;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ispinner.UISpinner;
import java.awt.*;
public class DisplayScaleConfPane extends BasicPane {
private UISpinner scaleSpinner;
public DisplayScaleConfPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(new FlowLayout(0, 0, 0));
scaleSpinner = new UISpinner(0, 100, 1, 100);
this.add(new UILabel("比例:"));
this.add(scaleSpinner);
}
public void populate(int value) {
if (value <= 0) {
value = 0;
}
if (value >= 100) {
value = 100;
}
scaleSpinner.setValue(value, true);
}
public int update() {
int value = (int) scaleSpinner.getValue();
if (value <= 0) {
value = 0;
}
if (value >= 100) {
value = 100;
}
return value;
}
@Override
protected String title4PopupWindow() {
return "显示比例";
}
}

74
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/LinkageConfPane.java

@ -0,0 +1,74 @@
package com.fr.plugin.third.party.jsdibgd.ui;
import com.fanruan.api.design.ui.component.UICheckBox;
import com.fanruan.api.design.ui.component.UILabel;
import com.fanruan.api.design.ui.component.UITextField;
import com.fanruan.api.design.ui.layout.TableLayoutKit;
import com.fr.design.dialog.BasicPane;
import com.fr.plugin.third.party.jsdibgd.CustomChartConfig;
import javax.swing.*;
import java.awt.*;
/**
* 柱形宽度配置
*/
public class LinkageConfPane extends BasicPane {
private UICheckBox linkedCheckBox;
private UITextField widgetNamesTextField;
private UITextField paraNameTextField;
public LinkageConfPane() {
this.initComponents();
}
protected void initComponents() {
this.setLayout(new BorderLayout());
JPanel panel0 = new JPanel();
panel0.setLayout(new FlowLayout(0, 0, 0));
linkedCheckBox = new UICheckBox();
widgetNamesTextField = new UITextField();
paraNameTextField = new UITextField();
paraNameTextField.setEditable(false);
UILabel label = new UILabel("联动组件名称:");
label.setToolTipText("多个名称用逗号隔开");
Component[][] components = new Component[][]{
{new UILabel("启用:"), linkedCheckBox},
{label, widgetNamesTextField},
{new UILabel("联动参数名称:"), paraNameTextField},
};
double p = TableLayoutKit.PREFERRED;
double[] rowSize = new double[]{p, p, p};
double[] columnSize = new double[]{p, 100};
JPanel settingsUI = TableLayoutKit.createTableLayoutPane(components, rowSize, columnSize);
this.add(settingsUI, BorderLayout.CENTER);
}
protected String title4PopupWindow() {
return "图表联动";
}
public void populate(CustomChartConfig conf) {
linkedCheckBox.setSelected(conf.isLinkEnable());
widgetNamesTextField.setText(conf.getWidgetNames());
paraNameTextField.setText(conf.getParaName());
}
public void update(CustomChartConfig conf) {
conf.setLinkEnable(linkedCheckBox.isSelected());
conf.setWidgetNames(widgetNamesTextField.getText());
conf.setParaName(paraNameTextField.getText());
}
private int getIntegerValue(double value) {
int tempValue = (int) value;
if (tempValue <= 0) {
tempValue = 0;
}
return tempValue;
}
}

45
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/spinner/CustomUIBoundSpinner.java

@ -0,0 +1,45 @@
package com.fr.plugin.third.party.jsdibgd.ui.spinner;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
/**
* 定制此组件,是为了修复若组件值和设置值相同时,不显示设置值问题
*/
public class CustomUIBoundSpinner extends CustomUISpinner {
public CustomUIBoundSpinner(double minValue, double maxValue, double dierta) {
super(minValue, maxValue, dierta);
}
public CustomUIBoundSpinner(double minValue, double maxValue, double dierta, double defaultValue) {
super(minValue, maxValue, dierta, defaultValue);
}
@Override
protected void initTextFiledListeners() {
this.getTextField().addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
setTextFieldValue(getTextField().getValue());
setTextField(value);
}
});
this.getTextField().addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
setTextFieldValue(getTextField().getValue());
setTextField(value);
}
}
});
}
@Override
protected void setTextField(double value) {
this.getTextField().setValue(value);
}
}

399
src/main/java/com/fr/plugin/third/party/jsdibgd/ui/spinner/CustomUISpinner.java

@ -0,0 +1,399 @@
package com.fr.plugin.third.party.jsdibgd.ui.spinner;
import com.fr.design.constants.UIConstants;
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.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIButtonUI;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.utils.gui.GUIPaintUtils;
import com.fr.stable.CommonUtils;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.plaf.ButtonUI;
import java.awt.*;
import java.awt.event.*;
/**
* 定制此组件,是为了修复若组件值和设置值相同时,不显示设置值问题
*/
public class CustomUISpinner extends JPanel implements UIObserver, GlobalNameObserver {
protected double value;
private static final int SIZE = 20;
private static final int LEN = 13;
private static final int WIDTH = 13;
private static final int HEIGHT = 10;
private static final int DEFAULT_NUMBERFIELD_COLUMNS = 2;
private UINumberField textField;
private UIButton preButton;
private UIButton nextButton;
private double minValue;
private double maxValue;
private double dierta;
private String spinnerName = StringUtils.EMPTY;
private UIObserverListener uiObserverListener;
private GlobalNameListener globalNameListener = null;
private boolean lessMinValue = false;
/**
* Spinner内的数字文本框长度
*/
private int numberFieldColumns;
public CustomUISpinner(double minValue, double maxValue, double dierta) {
init(minValue, maxValue, dierta);
}
public CustomUISpinner(double minValue, double maxValue, double dierta, double defaultValue) {
init(minValue, maxValue, dierta);
textField.setValue(defaultValue);
}
private void init(double minValue, double maxValue, double dierta) {
this.minValue = minValue;
this.maxValue = maxValue;
this.dierta = dierta;
initComponents();
iniListener();
}
private void iniListener() {
if (shouldResponseChangeListener()) {
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) {
return;
}
uiObserverListener.doChange();
}
});
}
}
/**
* 给组件分别加上FocusListener
*
* @param focusListener 监听事件
*/
public void addUISpinnerFocusListenner(FocusListener focusListener) {
this.addFocusListener(focusListener);
this.textField.addFocusListener(focusListener);
this.preButton.addFocusListener(focusListener);
this.nextButton.addFocusListener(focusListener);
}
public double getValue() {
return value;
}
@Override
public void setGlobalName(String name) {
spinnerName = name;
}
public UINumberField getTextField() {
return textField;
}
public UIButton getNextButton() {
return nextButton;
}
public boolean isLessMinValue() {
return lessMinValue;
}
public void resetLessMinValue() {
lessMinValue = false;
}
public void setValue(double value) {
setValue(value, true);
}
/**
* 赋值但不触发保存,只是展现,一般是populate的时候用
*
* @param value
*/
public void setValueWithoutEvent(double value) {
setValue(value, false);
}
public void setValue(double value, boolean fireStateChange) {
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(spinnerName);
}
lessMinValue = value < minValue;
value = lessMinValue ? minValue : value;
value = value > maxValue ? maxValue : value;
//if (CommonUtils.equals(value, this.value)) {
//return;
//}
this.value = value;
setTextField(value);
if (fireStateChange) {
fireStateChanged();
}
}
protected void setTextField(double value) {
textField.getDocument().removeDocumentListener(docListener);
textField.setValue(value);
textField.getDocument().addDocumentListener(docListener);
}
public void setTextFieldValue(double value) {
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(spinnerName);
}
lessMinValue = value < minValue;
value = lessMinValue ? minValue : value;
value = value > maxValue ? maxValue : value;
if (CommonUtils.equals(value, this.value)) {
return;
}
this.value = value;
fireStateChanged();
}
/**
* 设置Spinner内的数字输入框列数
*
* @param numberFieldColumns 输入框列数
*/
public void setNumberFieldColumns(int numberFieldColumns) {
textField.setColumns(numberFieldColumns);
}
@Override
public void setEnabled(boolean flag) {
super.setEnabled(flag);
this.textField.setEnabled(flag);
this.preButton.setEnabled(flag);
this.nextButton.setEnabled(flag);
}
@Override
public Dimension getPreferredSize() {
Dimension dim = super.getPreferredSize();
dim.height = SIZE;
return dim;
}
/**
* 增加 a <code>ChangeListener</code> to the listener list.
*
* @param l 监听事件
*/
public void addChangeListener(ChangeListener l) {
this.listenerList.add(ChangeListener.class, l);
}
/**
* 移除 a <code>ChangeListener</code> from the listener list.
*
* @param l 监听事件
*/
public void removeChangeListener(ChangeListener l) {
this.listenerList.remove(ChangeListener.class, l);
}
// august: Process the listeners last to first
protected void fireStateChanged() {
Object[] listeners = listenerList.getListenerList();
for (int i = listeners.length - 2; i >= 0; i -= 2) {
if (listeners[i] == ChangeListener.class) {
((ChangeListener) listeners[i + 1]).stateChanged(new ChangeEvent(this));
}
}
}
private class ButtionUI extends UIButtonUI {
private boolean isNormalPaint = true;
@Override
protected void doExtraPainting(UIButton b, Graphics2D g2d, int w, int h, String selectedRoles) {
if (isPressed(b) && b.isPressedPainted()) {
isNormalPaint = false;
Color pressColor = UIConstants.COMBOBOX_BTN_PRESS;
GUIPaintUtils.fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), pressColor);
} else if (isRollOver(b)) {
isNormalPaint = false;
Color hoverColor = UIConstants.COMBOBOX_BTN_ROLLOVER;
GUIPaintUtils.fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted(), hoverColor);
} else if (b.isNormalPainted()) {
isNormalPaint = true;
GUIPaintUtils.fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted());
}
}
@Override
protected void paintModelIcon(ButtonModel model, Icon icon, Graphics g, JComponent c) {
if (isNormalPaint) {
g.setColor(UIConstants.COMBOBOX_BTN_NORMAL);
g.fillRect(0, 0, c.getWidth(), c.getHeight());
}
super.paintModelIcon(model, icon, g, c);
}
}
private void initComponents() {
textField = initNumberField();
textField.setMaxValue(maxValue);
textField.setMinValue(minValue);
setValue(value);
preButton = new UIButton(UIConstants.ARROW_UP_ICON) {
@Override
public boolean shouldResponseChangeListener() {
return false;
}
@Override
public ButtonUI getUI() {
return new ButtionUI();
}
};
preButton.setRoundBorder(true, Constants.LEFT);
nextButton = new UIButton(UIConstants.ARROW_DOWN_ICON) {
@Override
public boolean shouldResponseChangeListener() {
return false;
}
@Override
public ButtonUI getUI() {
return new ButtionUI();
}
};
nextButton.setRoundBorder(true, Constants.LEFT);
setLayout(new BorderLayout());
add(textField, BorderLayout.CENTER);
JPanel arrowPane = new JPanel();
arrowPane.setPreferredSize(new Dimension(LEN, SIZE));
arrowPane.setLayout(new GridLayout(2, 1));
preButton.setBounds(0, 1, WIDTH, HEIGHT);
nextButton.setBounds(0, HEIGHT, WIDTH, HEIGHT);
arrowPane.add(preButton);
arrowPane.add(nextButton);
add(arrowPane, BorderLayout.EAST);
componentInitListeners();
}
private void componentInitListeners() {
preButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setValue(value + dierta);
}
});
nextButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setValue(value - dierta);
}
});
addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
if (isEnabled() && e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
setValue(value - e.getWheelRotation());
}
}
});
initTextFiledListeners();
}
protected void initTextFiledListeners() {
textField.getDocument().removeDocumentListener(docListener);
textField.getDocument().addDocumentListener(docListener);
textField.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
textField.getDocument().removeDocumentListener(docListener);
textField.setValue(value);
textField.getDocument().addDocumentListener(docListener);
}
});
}
protected UINumberField initNumberField() {
int columns = this.numberFieldColumns == 0 ? DEFAULT_NUMBERFIELD_COLUMNS : this.numberFieldColumns;
return new UINumberField(columns) {
@Override
public boolean shouldResponseChangeListener() {
return false;
}
};
}
private DocumentListener docListener = new DocumentListener() {
@Override
public void removeUpdate(DocumentEvent e) {
setTextFieldValue(textField.getValue());
}
@Override
public void insertUpdate(DocumentEvent e) {
setTextFieldValue(textField.getValue());
}
@Override
public void changedUpdate(DocumentEvent e) {
setTextFieldValue(textField.getValue());
}
};
/**
* 给组件登记一个观察者监听事件
*
* @param listener 观察者监听事件
*/
@Override
public void registerChangeListener(UIObserverListener listener) {
uiObserverListener = listener;
}
/**
* 组件是否需要响应添加的观察者事件
*
* @return 如果需要响应观察者事件则返回true否则返回false
*/
@Override
public boolean shouldResponseChangeListener() {
return true;
}
/**
* 给组件登记一个全局名字观察者监听事件
*
* @param listener 观察者监听事件
*/
@Override
public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener;
}
/**
* 组件是否需要响应添加的观察者事件
*
* @return 如果需要响应观察者事件则返回true否则返回false
*/
@Override
public boolean shouldResponseNameListener() {
return true;
}
}

BIN
src/main/resources/com/fr/plugin/third/party/jsdibgd/images/beam.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

BIN
src/main/resources/com/fr/plugin/third/party/jsdibgd/images/chart_icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 854 B

BIN
src/main/resources/com/fr/plugin/third/party/jsdibgd/images/chart_type.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
src/main/resources/com/fr/plugin/third/party/jsdibgd/images/chart_type_demo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
src/main/resources/com/fr/plugin/third/party/jsdibgd/images/label_bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
src/main/resources/com/fr/plugin/third/party/jsdibgd/images/point.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
src/main/resources/com/fr/plugin/third/party/jsdibgd/images/triangle.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

52
src/main/resources/com/fr/plugin/third/party/jsdibgd/web/common.css

@ -0,0 +1,52 @@
#JsdibgdTooltip {
position: absolute;
width: 160px;
height: 110px;
background-repeat: no-repeat;
background-size: cover;
z-index: 1000;
pointer-events: none;
}
#JsdibgdTooltip-deptName {
font-size: 12px;
margin-top: 18px;
float: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 160px;
text-align: center;
}
.JsdibgdTooltip-value {
font-size: 12px;
margin-top: 2px;
float: left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 160px;
color: #ffffff;
}
.JsdibgdTooltip-value-img {
width: 10px;
height: 11px;
background-repeat: no-repeat;
float: left;
margin-left: 10px;
margin-top: 4px;
background-size: cover;
margin-right: 8px;
}
.JsdibgdTooltip-value-title {
width: 48px;
float: left;
text-align-last:justify;
text-align:justify;
text-justify:distribute-all-lines;
}

420
src/main/resources/com/fr/plugin/third/party/jsdibgd/web/customChartWrapper.js

@ -0,0 +1,420 @@
!(function () {
window.JsdibgdMap = window.JsdibgdMap || {};
JsdibgdMap.currentIndex = 0;
JsdibgdMap.lastClickTimestamp = 0;
JsdibgdMap.earthChart = {};
JsdibgdMap.option = {};
JsdibgdMap.tooltipId = "JsdibgdTooltip";
JsdibgdMap.jqueryTooltipId = "#JsdibgdTooltip";
JsdibgdMap.jqueryTooltipIdDeptName = "#JsdibgdTooltip-deptName";
Van.FRChartBridge.customChartJsdibgdWrapper = Van.FRChartBridge.AbstractChart.extend({
_init: function (dom, option) {
//debugger;
//var mapChart = echarts.init(dom, null, {renderer: 'svg'});
$(JsdibgdMap.jqueryTooltipId).remove();
var labelBgPath = FR.fineServletURL + '/resources?path=com/fr/plugin/third/party/jsdibgd/images/label_bg.png';
var trianglePath = FR.fineServletURL + '/resources?path=com/fr/plugin/third/party/jsdibgd/images/triangle.png';
var tooltipContent = '<div id="JsdibgdTooltip" style="background-image:url(' + labelBgPath + ');" >' +
'<div id="JsdibgdTooltip-deptName"></div>' +
'<div class="JsdibgdTooltip-value" style="margin-top: 4px;"><div class="JsdibgdTooltip-value-img" style="background-image:url(' + trianglePath + ');"></div><div class="JsdibgdTooltip-value-title">新签合同</div>&nbsp;:&nbsp;<span id="JsdibgdTooltip-newContract"></span></div>' +
'<div class="JsdibgdTooltip-value" ><div class="JsdibgdTooltip-value-img" style="background-image:url(' + trianglePath + ');"></div><div class="JsdibgdTooltip-value-title">产值</div>&nbsp;:&nbsp;<span id="JsdibgdTooltip-outputValue"></span></div>' +
'<div class="JsdibgdTooltip-value" ><div class="JsdibgdTooltip-value-img" style="background-image:url(' + trianglePath + ');"></div><div class="JsdibgdTooltip-value-title">利润</div>&nbsp;:&nbsp;<span id="JsdibgdTooltip-profit"></span></div>' +
'<div class="JsdibgdTooltip-value" ><div class="JsdibgdTooltip-value-img" style="background-image:url(' + trianglePath + ');"></div><div class="JsdibgdTooltip-value-title">现金流</div>&nbsp;:&nbsp;<span id="JsdibgdTooltip-cashFlow"></span></div>' +
'</div>';
$('body').append(tooltipContent);
var mapChart = echarts.init(dom);
JsdibgdMap.earthChart = mapChart;
JsdibgdMap.option = option;
this._setConfigJsdibgd(mapChart, option, false);
mapChart.on('click', this.getLinkFun());
var tempThis = this;
mapChart.on('mouseover', function (params) {
if (tempThis._isNotPoint(params)) {
return;
}
var index = params.data.dataIndex - 1;
JsdibgdMap.currentIndex = index;
JsdibgdMap.lastClickTimestamp = new Date().getTime();
tempThis._setConfigJsdibgd(JsdibgdMap.earthChart, JsdibgdMap.option, true);
});
return mapChart;
},
_refresh: function (chart, option) {
var flag = this._isRefreshJsdibgd();
if (!flag) {
return;
}
this._setConfigJsdibgd(chart, option, true);
},
_resize: function (chart) {
chart.resize();
},
_emptyData: function (options) {
return options.series.data.length === 0;
},
_linkJsdibgd: function () {
//debugger;
this.getLinkFun();
},
_isPoint: function (params) {
if (params && params.componentType && (params.componentType == 'series')) {
return true;
}
return false;
},
_isNotPoint: function (params) {
return !this._isPoint(params);
},
_doLink: function (params) {
if (this._isNotPoint(params)) {
return;
}
var hyperLink = params.hyperLink || this.options.chartAttr.hyperLink;
this._doLinkWithFilter(params, hyperLink);
},
_isRefreshJsdibgd: function () {
var currentTimestamp = new Date().getTime();
var lastTimestamp = JsdibgdMap.lastClickTimestamp + 10 * 1000;
if (lastTimestamp >= currentTimestamp) {
return false;
}
return true;
},
_setConfigJsdibgd: function (earthChart, option, refreshOption) {
if (!(option.dataStatus === true)) {
return;
}
var mapConfig = option.mapConfig;
var stationNameFontConfig = option.stationNameFontConfig;
var configDatas = option.configDatas;
if ((configDatas == undefined) || (configDatas.length <= 0)) {
return;
}
var cIndex = JsdibgdMap.currentIndex;
if (refreshOption && (refreshOption == true)) {
cIndex = JsdibgdMap.currentIndex + 1
}
if (cIndex >= configDatas.length) {
cIndex = 0;
}
JsdibgdMap.currentIndex = cIndex;
var currentData = configDatas[JsdibgdMap.currentIndex];
var dataContent = new Array();
var effectContent = new Array();
var configData;
var tempData;
var currentPlace;
var currentConfigData;
for (var i = 0, max = configDatas.length - 1; i <= max; i++) {
configData = configDatas[i];
tempData = {
value: configData.place,
areaName: configData.areaName,
deptName: configData.deptName,
outputValue: configData.outputValue,
profit: configData.profit,
cashFlow: configData.cashFlow,
newContract: configData.newContract,
dataIndex: configData.dataIndex
}
if (i == JsdibgdMap.currentIndex) {
effectContent.push(tempData);
currentPlace = configData.place;
currentConfigData = configData;
//continue;
}
dataContent.push(tempData);
}
var labelBgPath = FR.fineServletURL + '/resources?path=com/fr/plugin/third/party/jsdibgd/images/label_bg.png';
var trianglePath = FR.fineServletURL + '/resources?path=com/fr/plugin/third/party/jsdibgd/images/triangle.png';
var beamPath = FR.fineServletURL + '/resources?path=com/fr/plugin/third/party/jsdibgd/images/beam.png';
var pointPath = 'image://' + FR.fineServletURL + '/resources?path=com/fr/plugin/third/party/jsdibgd/images/point.png';
var geoOption = {
//backgroundColor: 'rgba(0,23,30,1)',
backgroundColor: 'transparent',
geo: {
map: 'custom_map',
left: 0,
top: 5,
right: 0,
bottom: 0,
//boundingCoords: [[-180, 90], [180, -90]],
zoom: 0.95, //当前视角的缩放比例
aspectScale: 0.86,
roam: false,
itemStyle: {
areaColor: '#062355',
borderColor: '#357cf8',
},
tooltip: {
show: false
},
emphasis: {
label: {
show: false
},
itemStyle: {
areaColor: {
type: 'radial',
x: 0.5,
y: 0.5,
r: 0.5,
colorStops: [{
offset: 0, color: '#062355' // 0% 处的颜色
}, {
offset: 0.7, color: '#062355' // 0% 处的颜色
}, {
offset: 0.8, color: 'rgba(21, 233, 77, 0)' // 100% 处的颜色
}, {
offset: 1, color: 'rgba(21, 233, 77, 0.05)' // 100% 处的颜色
}],
global: true // 缺省为 false
},
borderColor: '#15e94d',
borderWidth: 2,
shadowColor: 'rgba(21, 233, 77, 0.05)',
shadowBlur: 10
}
},
select: {
label: {
show: false
}
},
label: {
show: false,
textStyle: {
fontSize: 22,
fontWeight: 'lighter',
color: '#ff0000'
}
},
regions: [{
name: currentData.areaName1,
selected: true,
select: {
itemStyle: {
areaColor: {
type: 'radial',
x: 0.5,
y: 0.5,
r: 0.5,
colorStops: [{
offset: 0, color: '#062355' // 0% 处的颜色
}, {
offset: 0.7, color: '#062355' // 0% 处的颜色
}, {
offset: 0.8, color: 'rgba(21, 233, 77, 0)' // 100% 处的颜色
}, {
offset: 1, color: 'rgba(21, 233, 77, 0.05)' // 100% 处的颜色
}],
global: true // 缺省为 false
},
borderColor: '#15e94d',
borderWidth: 2,
shadowColor: 'rgba(21, 233, 77, 0.05)',
shadowBlur: 10
}
}
}]
},
tooltip: {
show: false,
alwaysShowContent: true
},
series: [
{
type: 'scatter',
coordinateSystem: 'geo',
zlevel: 3,
//color: mapConfig.positionDynamicColor,
silent: false,
name: "数据",
rippleEffect: {
brushType: 'stroke'
},
symbolSize: mapConfig.mapSymbolSize,
symbol: pointPath,
label: {
show: false, //-------------------------
position: 'right',
formatter: '{b}',
textStyle: {
fontWeight: 'lighter',
fontSize: stationNameFontConfig.size,
color: stationNameFontConfig.color
}
},
tooltip: {
show: false,
alwaysShowContent: true,
formatter: function (params) {
console.log(params);
return "test";
}
},
emphasis: {
itemStyle: {
color: '#ff6815',
}
},
data: dataContent
}, {
name: "光束",
type: 'scatter',
coordinateSystem: 'geo',
zlevel: 4,
//color: mapConfig.positionDynamicColor,
silent: false,
rippleEffect: {
brushType: 'stroke'
},
symbolSize: 0,
symbol: pointPath,
label: {
show: true,
position: 'top',
distance: 5,
width: 4,
height: 30,
formatter: '',
backgroundColor: {
image: beamPath
},
},
emphasis: {
scale: true,
},
data: effectContent
}, {
name: "提示信息",
type: 'effectScatter',
coordinateSystem: 'geo',
zlevel: 5,
//color: mapConfig.positionDynamicColor,
silent: false,
rippleEffect: {
brushType: 'stroke'
},
symbolSize: mapConfig.selectSymbolSize,
symbol: pointPath,
label: {
show: false,
position: 'top',
distance: 25,
width: 160,
height: 110,
formatter: function (params) {
//debugger;
return '{hr|}\n{a|' + params.data.deptName + '}\n{hr1|}\n {c| } {b| 产  值 : ' + params.data.outputValue + '}\n{hr2|}\n {c| } {b| 利  润 : ' + params.data.profit + '}\n{hr2|}\n {c| } {b| 现 金 流 : ' + params.data.cashFlow + '}\n{hr2|}\n {c| } {b| 新签合同 : ' + params.data.newContract + '}';
},
//backgroundColor: '#c6faff',
backgroundColor: {
image: labelBgPath
},
//borderColor: '#00fdfc',
borderWidth: 0,
borderRadius: 4,
rich: {
a: {
color: '#000000',
//lineHeight: 40,
align: 'center',
// backgroundColor: '#2b9fff',
},
hr: {
borderColor: 'transparent',
width: '100%',
borderWidth: 2,
height: 20
},
hr1: {
borderColor: 'transparent',
width: '100%',
borderWidth: 2,
height: 11
},
hr2: {
borderColor: 'transparent',
width: '100%',
borderWidth: 2,
height: 5
},
b: {
color: '#ffffff',
//fontSize: 14,
//fontWeight: 'bold',
//lineHeight: 20,
align: 'left'
},
c: {
color: 'transparent',
//fontSize: 14,
//fontWeight: 'bold',
//lineHeight: 20,
align: 'left',
backgroundColor: {
image: trianglePath
},
},
per: {
color: '#fff',
backgroundColor: '#4C5058',
padding: [3, 4],
borderRadius: 4
}
}
},
emphasis: {
scale: true,
},
data: effectContent
}
]
};
if (refreshOption && (refreshOption == true)) {
earthChart.setOption(geoOption, true);
} else {
earthChart.setOption(geoOption);
}
JsdibgdMap.earthChart = earthChart;
JsdibgdMap.option = option;
var tempPlace = earthChart.convertToPixel('geo', currentPlace);
//console.log(tempPlace);
var leftValue = $(earthChart._dom).offset().left + (tempPlace[0].toFixed(2) - 80 + 0);
var topValue = $(earthChart._dom).offset().top + (tempPlace[1].toFixed(2) - 145 + 0);
if (leftValue < 0) {
leftValue = 0;
}
if (topValue < 0) {
topValue = 0;
}
leftValue = leftValue + "px";
topValue = topValue + "px";
$(JsdibgdMap.jqueryTooltipId).css("left", leftValue);
$(JsdibgdMap.jqueryTooltipId).css("top", topValue);
$(JsdibgdMap.jqueryTooltipIdDeptName).text(currentConfigData.deptName);
$('#JsdibgdTooltip-outputValue').text(currentConfigData.outputValue);
$('#JsdibgdTooltip-profit').text(currentConfigData.profit);
$('#JsdibgdTooltip-cashFlow').text(currentConfigData.cashFlow);
$('#JsdibgdTooltip-newContract').text(currentConfigData.newContract);
}
})
})();

919
src/main/resources/com/fr/plugin/third/party/jsdibgd/web/custom_map.js

File diff suppressed because one or more lines are too long

7
src/main/resources/com/fr/plugin/third/party/jsdibgd/web/echarts-adapter.js

@ -0,0 +1,7 @@
var document = {
createElement: function(element) {
if (element == 'canvas') {
return new Canvas();
}
},
};

1
src/main/resources/com/fr/plugin/third/party/jsdibgd/web/echarts-gl.min.js vendored

File diff suppressed because one or more lines are too long

45
src/main/resources/com/fr/plugin/third/party/jsdibgd/web/echarts.min.js vendored

File diff suppressed because one or more lines are too long

BIN
定制地图插件使用手册.docx

Binary file not shown.
Loading…
Cancel
Save