LAPTOP-SB56SG4Q\86185
3 years ago
36 changed files with 4611 additions and 1 deletions
Binary file not shown.
@ -1,3 +1,6 @@
|
||||
# open-JSD-8199 |
||||
|
||||
JSD-8199 甘特图扩展 |
||||
JSD-8199 甘特图扩展\ |
||||
免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ |
||||
仅作为开发者学习参考使用!禁止用于任何商业用途!\ |
||||
为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。 |
Binary file not shown.
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||||
<plugin> |
||||
<id>com.fr.plugin.third.party.jsd8199</id> |
||||
<name><![CDATA[甘特图定制]]></name> |
||||
<active>yes</active> |
||||
<version>0.5</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.jsdibjj.CustomGanttType" chartID="CUSTOM_GANTT_CHART_JSD8199"/> |
||||
</extra-chart> |
||||
<extra-chart-designer> |
||||
<ChartTypeUIProvider class="com.fr.plugin.third.party.jsdibjj.CustomGanttUI" chartID="CUSTOM_GANTT_CHART_JSD8199"/> |
||||
</extra-chart-designer> |
||||
<function-recorder class="com.fr.plugin.third.party.jsdibjj.CustomGanttType"/> |
||||
</plugin> |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,51 @@
|
||||
package com.fr.plugin.third.party.jsdibjj; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
public class CustomGanttData implements Serializable, Cloneable { |
||||
public static String SHOW_TYPE_SERIES = "SERIES"; |
||||
public static String SHOW_TYPE_FILL = "FILL"; |
||||
public static String SHOW_TYPE_BACKGROUND = "BACKGROUND"; |
||||
public static String SHOW_TYPE_IMAGE = "IMAGE"; |
||||
|
||||
public int index = 0; |
||||
public long beginDate = 0; |
||||
public long endDate = 0; |
||||
|
||||
public String beginDateShow = ""; |
||||
public String endDateShow = ""; |
||||
|
||||
public long milestoneDate = 0; |
||||
public double schedule = 0; |
||||
public String scheduleShow = ""; |
||||
public String showName = ""; |
||||
public String category = ""; |
||||
public String originalName = ""; |
||||
public String seriesValue = ""; |
||||
public String milestoneInfo =""; |
||||
|
||||
/** |
||||
* 已完成颜色 |
||||
*/ |
||||
public int completedColor = 0; |
||||
public String completedColorHex = ""; |
||||
/** |
||||
* 未完成颜色 |
||||
*/ |
||||
public int incompleteColor = 0; |
||||
public String incompleteColorHex = ""; |
||||
|
||||
public long prevEndDate = 0; |
||||
public boolean visible = true; |
||||
public String showType = SHOW_TYPE_SERIES; |
||||
|
||||
public int days = 0; |
||||
|
||||
/*脱节的中间值,主要为脱节闪烁用的*/ |
||||
public long middleValue = 0; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return this.showName + ":" + this.beginDateShow + "-" + this.endDateShow; |
||||
} |
||||
} |
@ -0,0 +1,510 @@
|
||||
package com.fr.plugin.third.party.jsdibjj; |
||||
|
||||
import com.fanruan.api.log.LogKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
import com.fr.general.GeneralUtils; |
||||
import com.fr.json.JSON; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONFactory; |
||||
import com.fr.json.JSONObject; |
||||
import com.fr.plugin.third.party.jsdibjj.data.CustomGanttColumnFieldCollection; |
||||
|
||||
import java.awt.*; |
||||
import java.math.BigDecimal; |
||||
import java.text.SimpleDateFormat; |
||||
import java.util.*; |
||||
import java.util.List; |
||||
|
||||
public class CustomGanttDataFactory { |
||||
public static synchronized List<String> createProjectNames(CustomGanttColumnFieldCollection dataSource) { |
||||
List<String> projectList = new ArrayList<>(); |
||||
if (dataSource == null) { |
||||
return projectList; |
||||
} |
||||
List<Object> projectNames = dataSource.getProjectName().getValues(); |
||||
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; |
||||
} |
||||
|
||||
public static synchronized JSONArray createJsonData(CustomGanttColumnFieldCollection dataSource, CustomGanttChart ganttChartConf) { |
||||
List<CustomGanttData> datas = createData(dataSource); |
||||
return createJsonData(dataSource, datas, ganttChartConf); |
||||
} |
||||
|
||||
|
||||
public static synchronized JSONArray createFlashingData(List<CustomGanttData> datas) { |
||||
JSONArray jsonContent = JSONFactory.createJSON(JSON.ARRAY); |
||||
if ((datas == null) || (datas.size() <= 0)) { |
||||
return jsonContent; |
||||
} |
||||
JSONArray jsonArray; |
||||
CustomGanttData ganttData; |
||||
for (int i = 0, max = datas.size() - 1; i <= max; i++) { |
||||
ganttData = datas.get(i); |
||||
if (!StringKit.equals(ganttData.showType, CustomGanttData.SHOW_TYPE_FILL)) { |
||||
continue; |
||||
} |
||||
jsonArray = JSONFactory.createJSON(JSON.ARRAY); |
||||
jsonArray.put(ganttData.index); |
||||
jsonArray.put(ganttData.middleValue); |
||||
JSONObject valueJson = JSONFactory.createJSON(JSON.OBJECT); |
||||
valueJson.put("value", jsonArray); |
||||
jsonContent.put(valueJson); |
||||
} |
||||
return jsonContent; |
||||
} |
||||
|
||||
public static synchronized JSONArray createJsonData(CustomGanttColumnFieldCollection dataSource, List<CustomGanttData> datas, CustomGanttChart ganttChartConf) { |
||||
JSONArray jsonContent = JSONFactory.createJSON(JSON.ARRAY); |
||||
if ((datas == null) || (datas.size() <= 0)) { |
||||
return jsonContent; |
||||
} |
||||
JSONObject jsonObject; |
||||
JSONArray jsonArray; |
||||
CustomGanttData ganttData; |
||||
|
||||
JSONObject emphasisJson = JSONFactory.createJSON(JSON.OBJECT); |
||||
if (ganttChartConf.isEmphasisOption()) { |
||||
JSONObject itemStyleJson = JSONFactory.createJSON(JSON.OBJECT); |
||||
itemStyleJson.put("borderColor", rgbToHex(new Color(ganttChartConf.getEmphasisBorderColor()))); |
||||
itemStyleJson.put("borderWidth", ganttChartConf.getEmphasisBorderWidth()); |
||||
itemStyleJson.put("borderType", "solid"); |
||||
//itemStyleJson.put("borderWidth",2);
|
||||
emphasisJson.put("itemStyle", itemStyleJson); |
||||
} |
||||
/* |
||||
JSONObject itemStyleJson = JSONFactory.createJSON(JSON.OBJECT).put("normal", JSONFactory.createJSON(JSON.OBJECT).put("color", "#7b9ce1")); |
||||
JSONObject emphasisJson = JSONFactory.createJSON(JSON.OBJECT); |
||||
emphasisJson.put("borderColor", "red"); |
||||
emphasisJson.put("borderWidth", 20); |
||||
emphasisJson.put("borderType", "solid"); |
||||
itemStyleJson.put("","")*/ |
||||
|
||||
for (int i = 0, max = datas.size() - 1; i <= max; i++) { |
||||
ganttData = datas.get(i); |
||||
jsonObject = JSONFactory.createJSON(JSON.OBJECT); |
||||
jsonObject.put("category", ganttData.category); |
||||
jsonObject.put("name", ganttData.showName); |
||||
jsonObject.put("originalName", ganttData.originalName); |
||||
jsonObject.put("showType", ganttData.showType); |
||||
jsonObject.put("days", ganttData.days); |
||||
jsonObject.put("beginDateShow", ganttData.beginDateShow); |
||||
jsonObject.put("endDateShow", ganttData.endDateShow); |
||||
jsonObject.put("middleValue", ganttData.middleValue); |
||||
jsonObject.put("seriesValue", ganttData.seriesValue); |
||||
|
||||
jsonArray = JSONFactory.createJSON(JSON.ARRAY); |
||||
jsonArray.put(ganttData.index); |
||||
jsonArray.put(ganttData.beginDate); |
||||
jsonArray.put(ganttData.endDate); |
||||
jsonArray.put(ganttData.showName); |
||||
jsonArray.put(ganttData.milestoneDate); |
||||
jsonArray.put(ganttData.schedule); |
||||
jsonArray.put(ganttData.completedColorHex); |
||||
jsonArray.put(ganttData.incompleteColorHex); |
||||
jsonArray.put(ganttData.scheduleShow); |
||||
jsonArray.put(ganttData.showType); |
||||
jsonArray.put(ganttData.middleValue); |
||||
jsonArray.put(ganttData.seriesValue); |
||||
jsonObject.put("value", jsonArray); |
||||
jsonObject.put("itemStyle", JSONFactory.createJSON(JSON.OBJECT).put("normal", JSONFactory.createJSON(JSON.OBJECT).put("color", "#7b9ce1"))); |
||||
jsonObject.put("emphasis", emphasisJson); |
||||
jsonContent.put(jsonObject); |
||||
} |
||||
return jsonContent; |
||||
} |
||||
|
||||
public static synchronized long createMinTimestamp(CustomGanttColumnFieldCollection dataSource) { |
||||
List<Object> beginDates = dataSource.getBeginDate().getValues(); |
||||
int size = beginDates.size(); |
||||
if (size <= 0) { |
||||
return 0; |
||||
} |
||||
Calendar cal = Calendar.getInstance(); |
||||
cal.set(2999, 1, 1); |
||||
long minTimestamp = cal.getTimeInMillis(); |
||||
; |
||||
long tempTimestamp = 0; |
||||
int count = 0; |
||||
for (int i = 0, max = size - 1; i <= max; i++) { |
||||
tempTimestamp = objectToTimestamp(beginDates.get(i)); |
||||
if (minTimestamp > tempTimestamp) { |
||||
minTimestamp = tempTimestamp; |
||||
count++; |
||||
} |
||||
} |
||||
if (count <= 0) { |
||||
return 0; |
||||
} |
||||
return minTimestamp; |
||||
} |
||||
|
||||
|
||||
public static synchronized long createMaxTimestamp(CustomGanttColumnFieldCollection dataSource) { |
||||
List<Object> endDates = dataSource.getEndDate().getValues(); |
||||
int size = endDates.size(); |
||||
if (size <= 0) { |
||||
return 0; |
||||
} |
||||
Calendar cal = Calendar.getInstance(); |
||||
cal.set(1000, 1, 1); |
||||
|
||||
long maxTimestamp = cal.getTimeInMillis(); |
||||
long tempTimestamp = 0; |
||||
int count = 0; |
||||
for (int i = 0, max = size - 1; i <= max; i++) { |
||||
tempTimestamp = objectToTimestamp(endDates.get(i)); |
||||
if (maxTimestamp < tempTimestamp) { |
||||
maxTimestamp = tempTimestamp; |
||||
count++; |
||||
} |
||||
} |
||||
if (count <= 0) { |
||||
return 0; |
||||
} |
||||
return maxTimestamp; |
||||
} |
||||
|
||||
public static synchronized List<CustomGanttData> createData(CustomGanttColumnFieldCollection dataSource) { |
||||
List<CustomGanttData> datas = new ArrayList<>(); |
||||
List<String> projectList = createProjectNames(dataSource); |
||||
if (projectList.size() <= 0) { |
||||
return datas; |
||||
} |
||||
List<Object> projectNames = dataSource.getProjectName().getValues(); |
||||
List<Object> seriesNames = dataSource.getSeriesName().getValues(); |
||||
List<Object> seriesValues = dataSource.getSeriesValue().getValues(); |
||||
List<Object> beginDates = dataSource.getBeginDate().getValues(); |
||||
List<Object> endDates = dataSource.getEndDate().getValues(); |
||||
List<Object> schedules = dataSource.getSchedule().getValues(); |
||||
int size = projectNames.size(); |
||||
if (size <= 0) { |
||||
return datas; |
||||
} |
||||
String projectName, seriesName; |
||||
CustomGanttData ganttData; |
||||
for (int i = 0, max = size - 1; i <= max; i++) { |
||||
projectName = objectToString(projectNames.get(i)); |
||||
seriesName = objectToString(seriesNames.get(i)); |
||||
ganttData = new CustomGanttData(); |
||||
ganttData.category = projectName; |
||||
ganttData.index = getIndex(projectName, projectList); |
||||
ganttData.showName = createSeriesName(seriesName); |
||||
ganttData.originalName = seriesName; |
||||
ganttData.schedule = objectToRate(schedules.get(i)); |
||||
ganttData.scheduleShow = objectToRateShow(ganttData.schedule); |
||||
ganttData.beginDate = objectToTimestamp(beginDates.get(i)); |
||||
ganttData.endDate = objectToTimestamp(endDates.get(i)); |
||||
ganttData.beginDateShow = String.valueOf(beginDates.get(i)); |
||||
ganttData.endDateShow = String.valueOf(endDates.get(i)); |
||||
ganttData.seriesValue = String.valueOf(seriesValues.get(i)); |
||||
if ((ganttData.beginDate <= 0) || (ganttData.endDate <= 0)) { |
||||
LogKit.error("甘特图定制,解析开始时间或结束时间出错"); |
||||
return new ArrayList<CustomGanttData>(); |
||||
} |
||||
datas.add(ganttData); |
||||
} |
||||
|
||||
return datas; |
||||
} |
||||
|
||||
|
||||
public static synchronized List<CustomGanttData> createMilestoneDatas(CustomGanttColumnFieldCollection dataSource) { |
||||
List<CustomGanttData> datas = new ArrayList<>(); |
||||
List<String> projectList = createProjectNames(dataSource); |
||||
if (projectList.size() <= 0) { |
||||
return datas; |
||||
} |
||||
List<Object> projectNames = dataSource.getProjectName().getValues(); |
||||
List<Object> seriesNames = dataSource.getSeriesName().getValues(); |
||||
List<Object> seriesValues = dataSource.getSeriesValue().getValues(); |
||||
List<Object> beginDates = dataSource.getBeginDate().getValues(); |
||||
List<Object> endDates = dataSource.getEndDate().getValues(); |
||||
List<Object> schedules = dataSource.getSchedule().getValues(); |
||||
List<Object> milestoneDates = dataSource.getMilestoneDate().getValues(); |
||||
List<Object> milestoneIcons = dataSource.getMilestoneIcon().getValues(); |
||||
List<Object> milestoneInfos = dataSource.getMilestoneInfo().getValues(); |
||||
int size = projectNames.size(); |
||||
if (size <= 0) { |
||||
return datas; |
||||
} |
||||
|
||||
if (milestoneDates.size() <= 0) { |
||||
return datas; |
||||
} |
||||
|
||||
if (milestoneIcons.size() <= 0) { |
||||
return datas; |
||||
} |
||||
|
||||
String projectName, seriesName; |
||||
CustomGanttData ganttData; |
||||
String path; |
||||
for (int i = 0, max = size - 1; i <= max; i++) { |
||||
projectName = objectToString(projectNames.get(i)); |
||||
seriesName = objectToString(seriesNames.get(i)); |
||||
ganttData = new CustomGanttData(); |
||||
ganttData.category = projectName; |
||||
ganttData.index = getIndex(projectName, projectList); |
||||
ganttData.showName = createSeriesName(seriesName); |
||||
ganttData.originalName = seriesName; |
||||
ganttData.schedule = 0; |
||||
ganttData.scheduleShow = getIconPath(i, milestoneInfos); |
||||
ganttData.beginDate = objectToTimestamp(milestoneDates.get(i)); |
||||
ganttData.endDate = objectToTimestamp(milestoneDates.get(i)); |
||||
ganttData.beginDateShow = String.valueOf(milestoneDates.get(i));; |
||||
ganttData.endDateShow = ""; |
||||
path = getIconPath(i, milestoneIcons); |
||||
if (StringKit.isEmpty(path)) { |
||||
continue; |
||||
} |
||||
ganttData.seriesValue = path; |
||||
|
||||
if ((ganttData.beginDate <= 0) || (ganttData.endDate <= 0)) { |
||||
continue; |
||||
} |
||||
ganttData.showType = CustomGanttData.SHOW_TYPE_IMAGE; |
||||
datas.add(ganttData); |
||||
} |
||||
|
||||
return datas; |
||||
} |
||||
|
||||
public static synchronized JSONArray createMilestoneData(CustomGanttColumnFieldCollection dataSource) { |
||||
JSONArray dataArray = new JSONArray(); |
||||
|
||||
List<String> projectList = createProjectNames(dataSource); |
||||
if (projectList.size() <= 0) { |
||||
return dataArray; |
||||
} |
||||
List<Object> projectNames = dataSource.getProjectName().getValues(); |
||||
List<Object> milestoneDates = dataSource.getMilestoneDate().getValues(); |
||||
List<Object> milestoneIcons = dataSource.getMilestoneIcon().getValues(); |
||||
int size = projectNames.size(); |
||||
if (size <= 0) { |
||||
return dataArray; |
||||
} |
||||
|
||||
if (milestoneDates.size() <= 0) { |
||||
return dataArray; |
||||
} |
||||
String projectName; |
||||
int x; |
||||
long y; |
||||
String type = ""; |
||||
String path = ""; |
||||
JSONObject milestoneJson; |
||||
for (int i = 0, max = size - 1; i <= max; i++) { |
||||
projectName = objectToString(projectNames.get(i)); |
||||
x = getIndex(projectName, projectList); |
||||
y = objectToTimestamp(milestoneDates.get(i)); |
||||
if (y <= 0) { |
||||
continue; |
||||
} |
||||
type = "diamond"; |
||||
path = getIconPath(i, milestoneIcons); |
||||
if (StringKit.isNotEmpty(path)) { |
||||
type = "image"; |
||||
} |
||||
milestoneJson = new JSONObject(); |
||||
milestoneJson.put("x", x); |
||||
milestoneJson.put("y", y); |
||||
milestoneJson.put("type", type); |
||||
milestoneJson.put("path", path); |
||||
dataArray.add(milestoneJson); |
||||
} |
||||
return dataArray; |
||||
} |
||||
|
||||
private static String getIconPath(int index, List<Object> icons) { |
||||
if (index < 0) { |
||||
return ""; |
||||
} |
||||
if ((icons == null) || (icons.size() <= 0) || (index >= icons.size())) { |
||||
return ""; |
||||
} |
||||
|
||||
String path = String.valueOf(icons.get(index)); |
||||
path = StringKit.trim(path); |
||||
if (StringKit.isEmpty(path)) { |
||||
return ""; |
||||
} |
||||
return path; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 针对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"); |
||||
} |
||||
}; |
||||
|
||||
public static synchronized String timestampToDate(long value) { |
||||
Date date = new Date(value); |
||||
return threadLocalFormat.get().format(date); |
||||
} |
||||
|
||||
/** |
||||
* 转为时间戳 |
||||
* |
||||
* @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); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.fr.plugin.third.party.jsdibjj; |
||||
|
||||
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; |
||||
|
||||
@EnableMetrics |
||||
public class CustomGanttType extends BaseChartType { |
||||
|
||||
/** |
||||
* 该种图表所有的图表对象实例,比如柱形图就有堆积柱形图,百分比堆积柱形图等等 |
||||
* |
||||
* @return 所有的图表对象实例 |
||||
*/ |
||||
@Focus(id = "com.fr.plugin.third.party.jsd8199", text = "plugin-jsd-8199", source = Original.PLUGIN) |
||||
public BaseChartWithData[] getChartTypes() { |
||||
return new BaseChartWithData[]{ |
||||
new CustomGanttChart() |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 图表在web端展现时需要的JS文件 |
||||
* |
||||
* @return JS文件数组 |
||||
*/ |
||||
public String[] getRequiredJS() { |
||||
return new String[]{ |
||||
"com/fr/plugin/third/party/jsdibjj/web/echarts.min.js", |
||||
"com/fr/plugin/third/party/jsdibjj/web/customGanttPlusWrapper.js" |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 图表在web端展现时需要的CSS文件 |
||||
* |
||||
* @return CSS文件数组 |
||||
*/ |
||||
public String[] getRequiredCss() { |
||||
return new String[]{ |
||||
"com/fr/plugin/third/party/jsdibjj/web/customGanttPlus.css" |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* JS对象名,该对象一般是一个函数,执行后会在给定的dom中绘制图表 |
||||
* |
||||
* @return JS对象名 |
||||
*/ |
||||
public String getWrapperName() { |
||||
return "customGanttPlusWrapper"; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,60 @@
|
||||
package com.fr.plugin.third.party.jsdibjj; |
||||
|
||||
import com.fanruan.api.design.chart.*; |
||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||
import com.fr.plugin.third.party.jsdibjj.data.CustomGanttDataCellFieldsPane; |
||||
import com.fr.plugin.third.party.jsdibjj.data.CustomGanttDataSetFieldsPane; |
||||
import com.fr.plugin.third.party.jsdibjj.ui.CustomGanttShowSettingsPane; |
||||
import com.fr.plugin.third.party.jsdibjj.ui.CustomGanttTitlePane; |
||||
import com.fr.plugin.third.party.jsdibjj.ui.CustomGanttTypePane; |
||||
|
||||
|
||||
public class CustomGanttUI 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 CustomGanttDataSetFieldsPane(), |
||||
new CustomGanttDataCellFieldsPane() |
||||
); |
||||
} |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public BaseOtherPane[] getAttrPaneArray(AttributeChangeListener listener) { |
||||
return new BaseOtherPane[]{new CustomGanttTitlePane(), new CustomGanttShowSettingsPane(), new DefaultOtherPane()}; |
||||
} |
||||
|
||||
@Override |
||||
public String getIconPath() { |
||||
return "com/fr/plugin/third/party/jsdibjj/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/jsdibjj/images/chart_type_demo.png" |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.plugin.third.party.jsdibjj; |
||||
|
||||
/** |
||||
* @author fr.open |
||||
* @version 10.0 |
||||
* Created by fr.open on 2019-09-05 |
||||
*/ |
||||
public enum PieType { |
||||
PIE, |
||||
RING; |
||||
|
||||
public static PieType parseInt(int index) { |
||||
for (PieType type : PieType.values()) { |
||||
if (type.ordinal() == index) { |
||||
return type; |
||||
} |
||||
} |
||||
return PIE; |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.plugin.third.party.jsdibjj; |
||||
|
||||
|
||||
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()); |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,220 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.color; |
||||
|
||||
|
||||
import java.awt.Color; |
||||
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; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取循环颜色 |
||||
* |
||||
* @param confColors |
||||
* @param count |
||||
* @return |
||||
*/ |
||||
public static List<Color> getCycleColors(List<Color> confColors, int count) { |
||||
List<Color> colors = new ArrayList<>(); |
||||
if (count <= 0) { |
||||
return colors; |
||||
} |
||||
if (count <= 1) { |
||||
count = 1; |
||||
} |
||||
int max = count - 1; |
||||
if ((confColors == null) || (confColors.size() <= 0)) { |
||||
for (int i = 0; i <= max; i++) { |
||||
colors.add(Color.black); |
||||
} |
||||
return colors; |
||||
} |
||||
int size = confColors.size(); |
||||
int index = 0; |
||||
for (int i = 0; i <= max; i++) { |
||||
index = i % size; |
||||
colors.add(confColors.get(index)); |
||||
} |
||||
return colors; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,135 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.data; |
||||
|
||||
import com.fanruan.api.report.chart.field.BaseColumnFieldCollection; |
||||
import com.fr.chartx.data.annotations.KeyField; |
||||
import com.fr.chartx.data.field.ColumnField; |
||||
|
||||
|
||||
public class CustomGanttColumnFieldCollection extends BaseColumnFieldCollection { |
||||
|
||||
|
||||
/** |
||||
* 项目名称 |
||||
*/ |
||||
//@KeyField
|
||||
private ColumnField projectName = new ColumnField(); |
||||
|
||||
|
||||
/** |
||||
* 系列值 |
||||
*/ |
||||
// @KeyField
|
||||
private ColumnField seriesValue = new ColumnField(); |
||||
|
||||
|
||||
/** |
||||
* 系列名称 |
||||
*/ |
||||
//@KeyField
|
||||
private ColumnField seriesName = new ColumnField(); |
||||
|
||||
/** |
||||
* 开始时间 |
||||
*/ |
||||
private ColumnField beginDate = new ColumnField(); |
||||
/** |
||||
* 结束时间 |
||||
*/ |
||||
private ColumnField endDate = new ColumnField(); |
||||
|
||||
/** |
||||
* 里程碑时间 |
||||
*/ |
||||
private ColumnField milestoneDate = new ColumnField(); |
||||
|
||||
|
||||
/** |
||||
* 里程碑图片 |
||||
*/ |
||||
private ColumnField milestoneIcon = new ColumnField(); |
||||
|
||||
|
||||
/** |
||||
* 里程碑信息 |
||||
*/ |
||||
private ColumnField milestoneInfo = new ColumnField(); |
||||
|
||||
/** |
||||
* 进度 |
||||
*/ |
||||
private ColumnField schedule = new ColumnField(); |
||||
|
||||
|
||||
public ColumnField getProjectName() { |
||||
return projectName; |
||||
} |
||||
|
||||
public void setProjectName(ColumnField projectName) { |
||||
this.projectName = projectName; |
||||
} |
||||
|
||||
|
||||
public ColumnField getSeriesValue() { |
||||
return seriesValue; |
||||
} |
||||
|
||||
public void setSeriesValue(ColumnField seriesValue) { |
||||
this.seriesValue = seriesValue; |
||||
} |
||||
|
||||
public ColumnField getSeriesName() { |
||||
return seriesName; |
||||
} |
||||
|
||||
public void setSeriesName(ColumnField seriesName) { |
||||
this.seriesName = seriesName; |
||||
} |
||||
|
||||
public ColumnField getBeginDate() { |
||||
return beginDate; |
||||
} |
||||
|
||||
public void setBeginDate(ColumnField beginDate) { |
||||
this.beginDate = beginDate; |
||||
} |
||||
|
||||
public ColumnField getEndDate() { |
||||
return endDate; |
||||
} |
||||
|
||||
public void setEndDate(ColumnField endDate) { |
||||
this.endDate = endDate; |
||||
} |
||||
|
||||
public ColumnField getMilestoneDate() { |
||||
return milestoneDate; |
||||
} |
||||
|
||||
public void setMilestoneDate(ColumnField milestoneDate) { |
||||
this.milestoneDate = milestoneDate; |
||||
} |
||||
|
||||
public ColumnField getSchedule() { |
||||
return schedule; |
||||
} |
||||
|
||||
public void setSchedule(ColumnField schedule) { |
||||
this.schedule = schedule; |
||||
} |
||||
|
||||
public ColumnField getMilestoneIcon() { |
||||
return milestoneIcon; |
||||
} |
||||
|
||||
public void setMilestoneIcon(ColumnField milestoneIcon) { |
||||
this.milestoneIcon = milestoneIcon; |
||||
} |
||||
|
||||
public ColumnField getMilestoneInfo() { |
||||
return milestoneInfo; |
||||
} |
||||
|
||||
public void setMilestoneInfo(ColumnField milestoneInfo) { |
||||
this.milestoneInfo = milestoneInfo; |
||||
} |
||||
} |
@ -0,0 +1,96 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.data; |
||||
|
||||
import com.fanruan.api.design.chart.field.BaseCellDataFieldsPane; |
||||
import com.fanruan.api.design.ui.component.formula.UIFormulaTextField; |
||||
|
||||
import java.awt.*; |
||||
|
||||
public class CustomGanttDataCellFieldsPane extends BaseCellDataFieldsPane<CustomGanttColumnFieldCollection> { |
||||
private UIFormulaTextField projectNamePane; |
||||
private UIFormulaTextField seriesNamePane; |
||||
private UIFormulaTextField seriesValuePane; |
||||
private UIFormulaTextField beginDatePane; |
||||
private UIFormulaTextField endDatePane; |
||||
private UIFormulaTextField milestoneDatePane; |
||||
private UIFormulaTextField milestoneIconPane; |
||||
private UIFormulaTextField milestoneInfoPane; |
||||
private UIFormulaTextField schedulePane; |
||||
|
||||
public void initComponents() { |
||||
projectNamePane = new UIFormulaTextField(); |
||||
seriesNamePane = new UIFormulaTextField(); |
||||
seriesValuePane = new UIFormulaTextField(); |
||||
beginDatePane = new UIFormulaTextField(); |
||||
endDatePane = new UIFormulaTextField(); |
||||
milestoneDatePane = new UIFormulaTextField(); |
||||
milestoneIconPane = new UIFormulaTextField(); |
||||
milestoneInfoPane = new UIFormulaTextField(); |
||||
schedulePane = new UIFormulaTextField(); |
||||
super.initComponents(); |
||||
} |
||||
|
||||
@Override |
||||
protected String[] fieldLabels() { |
||||
return new String[]{ |
||||
"项目名称", "系列名称", "系列值", "开始时间", "结束时间", "里程碑时间", "里程碑图标", "里程碑信息", "进度" |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected Component[] fieldComponents() { |
||||
return new Component[]{ |
||||
projectNamePane, |
||||
seriesNamePane, |
||||
seriesValuePane, |
||||
beginDatePane, |
||||
endDatePane, |
||||
milestoneDatePane, |
||||
milestoneIconPane, |
||||
milestoneInfoPane, |
||||
schedulePane |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected UIFormulaTextField[] formulaPanes() { |
||||
return new UIFormulaTextField[]{ |
||||
projectNamePane, |
||||
seriesNamePane, |
||||
seriesValuePane, |
||||
beginDatePane, |
||||
endDatePane, |
||||
milestoneDatePane, |
||||
milestoneIconPane, |
||||
milestoneInfoPane, |
||||
schedulePane |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(CustomGanttColumnFieldCollection dataConf) { |
||||
populateField(projectNamePane, dataConf.getProjectName()); |
||||
populateField(seriesNamePane, dataConf.getSeriesName()); |
||||
populateField(seriesValuePane, dataConf.getSeriesValue()); |
||||
populateField(beginDatePane, dataConf.getBeginDate()); |
||||
populateField(endDatePane, dataConf.getEndDate()); |
||||
populateField(milestoneDatePane, dataConf.getMilestoneDate()); |
||||
populateField(milestoneIconPane, dataConf.getMilestoneIcon()); |
||||
populateField(milestoneInfoPane, dataConf.getMilestoneInfo()); |
||||
populateField(schedulePane, dataConf.getSchedule()); |
||||
} |
||||
|
||||
@Override |
||||
public CustomGanttColumnFieldCollection updateBean() { |
||||
CustomGanttColumnFieldCollection dataConf = new CustomGanttColumnFieldCollection(); |
||||
updateField(projectNamePane, dataConf.getProjectName()); |
||||
updateField(seriesNamePane, dataConf.getSeriesName()); |
||||
updateField(seriesValuePane, dataConf.getSeriesValue()); |
||||
updateField(beginDatePane, dataConf.getBeginDate()); |
||||
updateField(endDatePane, dataConf.getEndDate()); |
||||
updateField(milestoneDatePane, dataConf.getMilestoneDate()); |
||||
updateField(milestoneIconPane, dataConf.getMilestoneIcon()); |
||||
updateField(milestoneInfoPane, dataConf.getMilestoneInfo()); |
||||
updateField(schedulePane, dataConf.getSchedule()); |
||||
return dataConf; |
||||
} |
||||
} |
@ -0,0 +1,99 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.data; |
||||
|
||||
import com.fanruan.api.design.chart.field.BaseDataSetFieldsPane; |
||||
import com.fanruan.api.design.ui.component.UIComboBox; |
||||
import com.fr.plugin.third.party.jsdibjj.UIComboBoxWithNone; |
||||
import com.fr.plugin.third.party.jsdibjj.data.CustomGanttColumnFieldCollection; |
||||
|
||||
import java.awt.*; |
||||
|
||||
|
||||
public class CustomGanttDataSetFieldsPane extends BaseDataSetFieldsPane<CustomGanttColumnFieldCollection> { |
||||
private UIComboBoxWithNone projectNamePane; |
||||
private UIComboBoxWithNone seriesNamePane; |
||||
private UIComboBoxWithNone seriesValuePane; |
||||
private UIComboBoxWithNone beginDatePane; |
||||
private UIComboBoxWithNone endDatePane; |
||||
private UIComboBoxWithNone milestoneDatePane; |
||||
private UIComboBoxWithNone milestoneIconPane; |
||||
private UIComboBoxWithNone milestoneInfoPane; |
||||
private UIComboBoxWithNone schedulePane; |
||||
|
||||
public void initComponents() { |
||||
projectNamePane = new UIComboBoxWithNone(); |
||||
seriesNamePane = new UIComboBoxWithNone(); |
||||
seriesValuePane = new UIComboBoxWithNone(); |
||||
beginDatePane = new UIComboBoxWithNone(); |
||||
endDatePane = new UIComboBoxWithNone(); |
||||
milestoneDatePane = new UIComboBoxWithNone(); |
||||
milestoneIconPane = new UIComboBoxWithNone(); |
||||
milestoneInfoPane = new UIComboBoxWithNone(); |
||||
schedulePane = new UIComboBoxWithNone(); |
||||
super.initComponents(); |
||||
} |
||||
|
||||
@Override |
||||
protected String[] fieldLabels() { |
||||
return new String[]{ |
||||
"项目名称", "系列名称", "系列值", "开始时间", "结束时间", "里程碑时间", "里程碑图标", "里程碑信息", "进度" |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected Component[] fieldComponents() { |
||||
return new Component[]{ |
||||
projectNamePane, |
||||
seriesNamePane, |
||||
seriesValuePane, |
||||
beginDatePane, |
||||
endDatePane, |
||||
milestoneDatePane, |
||||
milestoneIconPane, |
||||
milestoneInfoPane, |
||||
schedulePane |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected UIComboBox[] filedComboBoxes() { |
||||
return new UIComboBox[]{ |
||||
projectNamePane, |
||||
seriesNamePane, |
||||
seriesValuePane, |
||||
beginDatePane, |
||||
endDatePane, |
||||
milestoneDatePane, |
||||
milestoneIconPane, |
||||
milestoneInfoPane, |
||||
schedulePane |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(CustomGanttColumnFieldCollection dataConf) { |
||||
populateField(projectNamePane, dataConf.getProjectName()); |
||||
populateField(seriesNamePane, dataConf.getSeriesName()); |
||||
populateField(seriesValuePane, dataConf.getSeriesValue()); |
||||
populateField(beginDatePane, dataConf.getBeginDate()); |
||||
populateField(endDatePane, dataConf.getEndDate()); |
||||
populateField(milestoneDatePane, dataConf.getMilestoneDate()); |
||||
populateField(milestoneIconPane, dataConf.getMilestoneIcon()); |
||||
populateField(milestoneInfoPane, dataConf.getMilestoneInfo()); |
||||
populateField(schedulePane, dataConf.getSchedule()); |
||||
} |
||||
|
||||
@Override |
||||
public CustomGanttColumnFieldCollection updateBean() { |
||||
CustomGanttColumnFieldCollection dataConf = new CustomGanttColumnFieldCollection(); |
||||
updateField(projectNamePane, dataConf.getProjectName()); |
||||
updateField(seriesNamePane, dataConf.getSeriesName()); |
||||
updateField(seriesValuePane, dataConf.getSeriesValue()); |
||||
updateField(beginDatePane, dataConf.getBeginDate()); |
||||
updateField(endDatePane, dataConf.getEndDate()); |
||||
updateField(milestoneDatePane, dataConf.getMilestoneDate()); |
||||
updateField(milestoneIconPane, dataConf.getMilestoneIcon()); |
||||
updateField(milestoneInfoPane, dataConf.getMilestoneInfo()); |
||||
updateField(schedulePane, dataConf.getSchedule()); |
||||
return dataConf; |
||||
} |
||||
} |
@ -0,0 +1,52 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.sort; |
||||
|
||||
public class DataSort { |
||||
/** |
||||
* 原序号 |
||||
*/ |
||||
private int index = 0; |
||||
/** |
||||
* 脱节天数 |
||||
*/ |
||||
private int disconnectDays = 0; |
||||
/** |
||||
* 新序号 |
||||
*/ |
||||
private int newIndex = 0; |
||||
|
||||
|
||||
private String projectName; |
||||
|
||||
|
||||
public int getIndex() { |
||||
return index; |
||||
} |
||||
|
||||
public void setIndex(int index) { |
||||
this.index = index; |
||||
} |
||||
|
||||
public int getDisconnectDays() { |
||||
return disconnectDays; |
||||
} |
||||
|
||||
public void setDisconnectDays(int days) { |
||||
this.disconnectDays = days; |
||||
} |
||||
|
||||
public int getNewIndex() { |
||||
return newIndex; |
||||
} |
||||
|
||||
public void setNewIndex(int newIndex) { |
||||
this.newIndex = newIndex; |
||||
} |
||||
|
||||
public String getProjectName() { |
||||
return projectName; |
||||
} |
||||
|
||||
public void setProjectName(String projectName) { |
||||
this.projectName = projectName; |
||||
} |
||||
} |
@ -0,0 +1,81 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.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.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.itextfield.UINumberField; |
||||
import com.fr.plugin.third.party.jsdibjj.CustomGanttChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
|
||||
/** |
||||
* 动画 |
||||
*/ |
||||
public class ColorAnimationConfPane extends BasicPane { |
||||
private static String[] SYMBOL_TYPES = {"rect", "circle", "roundRect", "triangle", "diamond", "pin", "arrow"}; |
||||
private static String[] SYMBOL_TYPE_NAMES = {"矩形", "圆形", "圆角矩形", "三角形", "菱形", "弹头", "箭头"}; |
||||
private UICheckBox enableCheckBox; |
||||
private UIComboBox symbolTypesComboBox; |
||||
private UINumberField widthNumberField; |
||||
|
||||
|
||||
public ColorAnimationConfPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
enableCheckBox = new UICheckBox("启用"); |
||||
|
||||
symbolTypesComboBox = new UIComboBox(SYMBOL_TYPE_NAMES); |
||||
symbolTypesComboBox.setSelectedIndex(0); |
||||
|
||||
widthNumberField = new UINumberField(5); |
||||
widthNumberField.setInteger(true); |
||||
widthNumberField.setValue(2); |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
{enableCheckBox, null}, |
||||
{new UILabel("形状:"), symbolTypesComboBox}, |
||||
{new UILabel("宽度:"), widthNumberField} |
||||
}; |
||||
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 "color"; |
||||
} |
||||
|
||||
|
||||
public void populate(CustomGanttChart conf) { |
||||
enableCheckBox.setSelected(conf.isAnimationOption()); |
||||
widthNumberField.setValue(conf.getSymbolWidth()); |
||||
int index = getSymbolTypeIndex(conf.getSymbolType()); |
||||
symbolTypesComboBox.setSelectedIndex(index); |
||||
} |
||||
|
||||
public CustomGanttChart update() { |
||||
CustomGanttChart conf = new CustomGanttChart(); |
||||
conf.setAnimationOption(enableCheckBox.isSelected()); |
||||
conf.setSymbolType(SYMBOL_TYPES[symbolTypesComboBox.getSelectedIndex()]); |
||||
conf.setSymbolWidth((int) widthNumberField.getValue()); |
||||
return conf; |
||||
} |
||||
|
||||
private int getSymbolTypeIndex(String type) { |
||||
for (int i = 0, max = SYMBOL_TYPES.length - 1; i <= max; i++) { |
||||
if (SYMBOL_TYPES[i].equalsIgnoreCase(type)) { |
||||
return i; |
||||
} |
||||
} |
||||
return 0; |
||||
} |
||||
} |
@ -0,0 +1,80 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.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.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.itextfield.UINumberField; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.plugin.third.party.jsdibjj.CustomGanttChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
|
||||
/** |
||||
* 时间线配置 |
||||
*/ |
||||
public class ColorDateLineConfPane extends BasicPane { |
||||
private UICheckBox enableCheckBox; |
||||
private ColorSelectBox colorSelectBox; |
||||
private UINumberField widthNumberField; |
||||
|
||||
|
||||
public ColorDateLineConfPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
JPanel panel0 = new JPanel(); |
||||
panel0.setLayout(new FlowLayout(0, 0, 0)); |
||||
enableCheckBox = new UICheckBox("启用"); |
||||
colorSelectBox = new ColorSelectBox(100); |
||||
|
||||
panel0.add(enableCheckBox); |
||||
panel0.add(colorSelectBox); |
||||
|
||||
//JPanel panel1= new JPanel();
|
||||
//panel1.setLayout( new FlowLayout(0, 0, 0));
|
||||
|
||||
widthNumberField = new UINumberField(5); |
||||
widthNumberField.setInteger(true); |
||||
//panel1.add(new JLabel("宽度"));
|
||||
//panel1.add(widthNumberField);
|
||||
|
||||
//Box vBox = Box.createVerticalBox();
|
||||
//vBox.add(panel0);
|
||||
//vBox.add(panel1);
|
||||
Component[][] components = new Component[][]{ |
||||
{enableCheckBox, null}, |
||||
{new UILabel("颜色:"), colorSelectBox}, |
||||
{new UILabel("宽度:"), widthNumberField} |
||||
}; |
||||
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 "color"; |
||||
} |
||||
|
||||
public void populate(CustomGanttChart conf) { |
||||
enableCheckBox.setSelected(conf.isCurrentTimeLineOption()); |
||||
colorSelectBox.setSelectObject(new Color(conf.getCurrentTimeLineColor())); |
||||
widthNumberField.setValue(conf.getCurrentTimeLineWidth()); |
||||
} |
||||
|
||||
public CustomGanttChart update() { |
||||
CustomGanttChart conf = new CustomGanttChart(); |
||||
conf.setCurrentTimeLineOption(enableCheckBox.isSelected()); |
||||
conf.setCurrentTimeLineColor(colorSelectBox.getSelectObject().getRGB()); |
||||
conf.setCurrentTimeLineWidth((int) widthNumberField.getValue()); |
||||
return conf; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,81 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.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.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.itextfield.UINumberField; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.plugin.third.party.jsdibjj.CustomGanttChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
|
||||
/** |
||||
* 时间线配置 |
||||
*/ |
||||
public class ColorEmphasisConfPane extends BasicPane { |
||||
private UICheckBox enableCheckBox; |
||||
private ColorSelectBox colorSelectBox; |
||||
private UINumberField widthNumberField; |
||||
|
||||
|
||||
public ColorEmphasisConfPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
JPanel panel0 = new JPanel(); |
||||
panel0.setLayout(new FlowLayout(0, 0, 0)); |
||||
enableCheckBox = new UICheckBox("启用"); |
||||
colorSelectBox = new ColorSelectBox(100); |
||||
|
||||
panel0.add(enableCheckBox); |
||||
panel0.add(colorSelectBox); |
||||
|
||||
//JPanel panel1= new JPanel();
|
||||
//panel1.setLayout( new FlowLayout(0, 0, 0));
|
||||
|
||||
widthNumberField = new UINumberField(5); |
||||
widthNumberField.setInteger(true); |
||||
//panel1.add(new JLabel("宽度"));
|
||||
//panel1.add(widthNumberField);
|
||||
|
||||
//Box vBox = Box.createVerticalBox();
|
||||
//vBox.add(panel0);
|
||||
//vBox.add(panel1);
|
||||
Component[][] components = new Component[][]{ |
||||
{enableCheckBox, null}, |
||||
{new UILabel("颜色:"), colorSelectBox}, |
||||
{new UILabel("宽度:"), widthNumberField} |
||||
}; |
||||
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 "color"; |
||||
} |
||||
|
||||
|
||||
public void populate(CustomGanttChart conf) { |
||||
enableCheckBox.setSelected(conf.isEmphasisOption()); |
||||
colorSelectBox.setSelectObject(new Color(conf.getEmphasisBorderColor())); |
||||
widthNumberField.setValue(conf.getEmphasisBorderWidth()); |
||||
} |
||||
|
||||
public CustomGanttChart update() { |
||||
CustomGanttChart conf = new CustomGanttChart(); |
||||
conf.setEmphasisOption(enableCheckBox.isSelected()); |
||||
conf.setEmphasisBorderColor(colorSelectBox.getSelectObject().getRGB()); |
||||
conf.setEmphasisBorderWidth((int) widthNumberField.getValue()); |
||||
return conf; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.ui; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.plugin.third.party.jsdibjj.CustomGanttChart; |
||||
|
||||
import java.awt.*; |
||||
|
||||
//import com.fr.van.chart.designer.component.border.VanChartBorderPane;
|
||||
public class ColorGapConfPane extends BasicPane { |
||||
private UICheckBox enableCheckBox; |
||||
private ColorSelectBox colorSelectBox; |
||||
|
||||
public ColorGapConfPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new FlowLayout(0, 0, 0)); |
||||
enableCheckBox = new UICheckBox("启用"); |
||||
colorSelectBox = new ColorSelectBox(100); |
||||
this.add(enableCheckBox); |
||||
this.add(colorSelectBox); |
||||
|
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return "color"; |
||||
} |
||||
|
||||
public void populate(CustomGanttChart conf) { |
||||
enableCheckBox.setSelected(conf.isFillGapOption()); |
||||
colorSelectBox.setSelectObject(new Color(conf.getFillGapColor())); |
||||
} |
||||
|
||||
public CustomGanttChart update() { |
||||
CustomGanttChart conf = new CustomGanttChart(); |
||||
conf.setFillGapOption(enableCheckBox.isSelected()); |
||||
conf.setFillGapColor(colorSelectBox.getSelectObject().getRGB()); |
||||
return conf; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,298 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.ui; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
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.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.plugin.third.party.jsdibjj.CustomGanttChart; |
||||
|
||||
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 UICheckBox enableCheckBox; |
||||
private UICheckBox dataSortCheckBox; |
||||
private ColorSelectBox oddColorSelectBox; |
||||
private ColorSelectBox evenColorSelectBox; |
||||
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); |
||||
int index = var2x.size() - 1; |
||||
ColorSeriesConfPane.this.colorList.setSelectedIndex(index); |
||||
} |
||||
} |
||||
}); |
||||
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, BorderLayout.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"); |
||||
|
||||
enableCheckBox = new UICheckBox("按项目循环颜色"); |
||||
this.add(enableCheckBox, BorderLayout.SOUTH); |
||||
|
||||
//dataSortCheckBox = new UICheckBox("脱节天数排序");
|
||||
dataSortCheckBox = new UICheckBox("奇偶背景颜色"); |
||||
oddColorSelectBox = new ColorSelectBox(40); |
||||
evenColorSelectBox = new ColorSelectBox(40); |
||||
Component[] components_font = new Component[]{ |
||||
dataSortCheckBox, oddColorSelectBox, evenColorSelectBox |
||||
}; |
||||
//this.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL), BorderLayout.SOUTH);
|
||||
this.checkButtonEnabled(); |
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return "printer"; |
||||
} |
||||
|
||||
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(); |
||||
if (var1 < 0) { |
||||
var2x.addElement(var1x); |
||||
int index = var2x.size() - 1; |
||||
ColorSeriesConfPane.this.colorList.setSelectedIndex(index); |
||||
return; |
||||
} |
||||
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(CustomGanttChart ob) { |
||||
populate(ob.getColors()); |
||||
enableCheckBox.setSelected(ob.isProjectCycleColor()); |
||||
dataSortCheckBox.setSelected(ob.isDataSort()); |
||||
oddColorSelectBox.setSelectObject(new Color(ob.getOddBackgroundColor())); |
||||
evenColorSelectBox.setSelectObject(new Color(ob.getEvenBackgroundColor())); |
||||
} |
||||
|
||||
private 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 void update(CustomGanttChart ob) { |
||||
ob.setColors(update()); |
||||
ob.setProjectCycleColor(enableCheckBox.isSelected()); |
||||
ob.setDataSort(dataSortCheckBox.isSelected()); |
||||
ob.setOddBackgroundColor(oddColorSelectBox.getSelectObject().getRGB()); |
||||
ob.setEvenBackgroundColor(evenColorSelectBox.getSelectObject().getRGB()); |
||||
} |
||||
|
||||
private 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; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.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.mainframe.backgroundpane.ColorBackgroundQuickPane; |
||||
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(); |
||||
} |
||||
} |
@ -0,0 +1,118 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.ui; |
||||
|
||||
import com.fanruan.api.design.chart.BaseOtherPane; |
||||
import com.fanruan.api.design.ui.component.UITitledBorder; |
||||
import com.fr.plugin.third.party.jsdibjj.CustomGanttChart; |
||||
import com.fr.van.chart.designer.component.VanChartFillStylePane; |
||||
import com.fr.van.chart.designer.style.series.VanChartAbstractPlotSeriesPane; |
||||
import com.fr.design.style.color.ColorAdjustPane; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class CustomGanttShowSettingsPane extends BaseOtherPane<CustomGanttChart> { |
||||
private DisplayScaleConfPane displayScaleConfPane; |
||||
private ColorGapConfPane colorGapConfPane; |
||||
private ColorDateLineConfPane colorDateLineConfPane; |
||||
private ColorSeriesConfPane colorListPane; |
||||
private ColorAnimationConfPane colorAnimationConfPane; |
||||
private ColorEmphasisConfPane colorEmphasisConfPane; |
||||
private YFontConfPane yFontConfPane; |
||||
|
||||
|
||||
@Override |
||||
public void populate(CustomGanttChart ob) { |
||||
colorGapConfPane.populate(ob); |
||||
colorListPane.populate(ob); |
||||
colorDateLineConfPane.populate(ob); |
||||
displayScaleConfPane.populate(ob); |
||||
colorAnimationConfPane.populate(ob); |
||||
colorEmphasisConfPane.populate(ob); |
||||
yFontConfPane.populate(ob); |
||||
} |
||||
|
||||
@Override |
||||
public void update(CustomGanttChart ob) { |
||||
CustomGanttChart conf = colorGapConfPane.update(); |
||||
ob.setFillGapOption(conf.isFillGapOption()); |
||||
ob.setFillGapColor(conf.getFillGapColor()); |
||||
|
||||
colorListPane.update(ob); |
||||
//ob.setColors(colorListPane.update());
|
||||
|
||||
CustomGanttChart conf1 = colorDateLineConfPane.update(); |
||||
ob.setCurrentTimeLineOption(conf1.isCurrentTimeLineOption()); |
||||
ob.setCurrentTimeLineColor(conf1.getCurrentTimeLineColor()); |
||||
ob.setCurrentTimeLineWidth(conf1.getCurrentTimeLineWidth()); |
||||
|
||||
//ob.setDisplayScale(displayScaleConfPane.update());
|
||||
displayScaleConfPane.update(ob); |
||||
|
||||
CustomGanttChart conf2 = colorAnimationConfPane.update(); |
||||
ob.setAnimationOption(conf2.isAnimationOption()); |
||||
ob.setSymbolType(conf2.getSymbolType()); |
||||
ob.setSymbolWidth(conf2.getSymbolWidth()); |
||||
|
||||
CustomGanttChart conf3 = colorEmphasisConfPane.update(); |
||||
ob.setEmphasisOption(conf3.isEmphasisOption()); |
||||
ob.setEmphasisBorderColor(conf3.getEmphasisBorderColor()); |
||||
ob.setEmphasisBorderWidth(conf3.getEmphasisBorderWidth()); |
||||
|
||||
CustomGanttChart conf4 = yFontConfPane.update(); |
||||
ob.setyAxisAxisLabelColor(conf4.getyAxisAxisLabelColor()); |
||||
ob.setyAxisAxisLabelFontStyle(conf4.getyAxisAxisLabelFontStyle()); |
||||
ob.setyAxisAxisLabelFontWeight(conf4.getyAxisAxisLabelFontWeight()); |
||||
ob.setyAxisAxisLabelFontFamily(conf4.getyAxisAxisLabelFontFamily()); |
||||
ob.setyAxisAxisLabelFontSize(conf4.getyAxisAxisLabelFontSize()); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
JPanel panel = new JPanel(new BorderLayout(0, 6)); |
||||
displayScaleConfPane = new DisplayScaleConfPane(); |
||||
displayScaleConfPane.setBorder(UITitledBorder.createBorderWithTitle("显示比例")); |
||||
|
||||
colorGapConfPane = new ColorGapConfPane(); |
||||
colorGapConfPane.setBorder(UITitledBorder.createBorderWithTitle("填充空白颜色设置")); |
||||
|
||||
colorDateLineConfPane = new ColorDateLineConfPane(); |
||||
colorDateLineConfPane.setBorder(UITitledBorder.createBorderWithTitle("日期线设置")); |
||||
|
||||
colorAnimationConfPane = new ColorAnimationConfPane(); |
||||
colorAnimationConfPane.setBorder(UITitledBorder.createBorderWithTitle("动画设置")); |
||||
|
||||
colorEmphasisConfPane = new ColorEmphasisConfPane(); |
||||
colorEmphasisConfPane.setBorder(UITitledBorder.createBorderWithTitle("选中设置")); |
||||
|
||||
yFontConfPane = new YFontConfPane(); |
||||
yFontConfPane.setBorder(UITitledBorder.createBorderWithTitle("Y轴字体设置")); |
||||
|
||||
colorListPane = new ColorSeriesConfPane(); |
||||
colorListPane.setBorder(UITitledBorder.createBorderWithTitle("系列渐变颜色设置")); |
||||
JPanel gapPanel = new JPanel(); |
||||
gapPanel.setBorder(UITitledBorder.createBorderWithTitle("")); |
||||
|
||||
|
||||
JPanel settingsUI1 = new JPanel(new BorderLayout()); |
||||
settingsUI1.add(displayScaleConfPane, BorderLayout.NORTH); |
||||
//settingsUI1.add(colorGapConfPane, BorderLayout.CENTER);
|
||||
|
||||
JPanel settingsUI2 = new JPanel(new BorderLayout()); |
||||
//settingsUI2.add(colorAnimationConfPane, BorderLayout.NORTH);
|
||||
settingsUI2.add(colorEmphasisConfPane, BorderLayout.CENTER); |
||||
settingsUI2.add(yFontConfPane, BorderLayout.SOUTH); |
||||
|
||||
JPanel settingsUI = new JPanel(new BorderLayout()); |
||||
settingsUI.add(settingsUI1, BorderLayout.NORTH); |
||||
settingsUI.add(colorDateLineConfPane, BorderLayout.CENTER); |
||||
settingsUI.add(settingsUI2, BorderLayout.SOUTH); |
||||
panel.add(settingsUI, BorderLayout.NORTH); |
||||
//panel.add(colorListPane, BorderLayout.CENTER);
|
||||
return panel; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "显示"; |
||||
} |
||||
} |
@ -0,0 +1,162 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.ui; |
||||
|
||||
import com.fanruan.api.design.chart.BaseOtherPane; |
||||
import com.fanruan.api.design.ui.component.UICheckBox; |
||||
import com.fanruan.api.design.ui.component.UILabel; |
||||
import com.fanruan.api.design.ui.component.UITitledBorder; |
||||
import com.fanruan.api.design.ui.component.formula.UIFormulaTextField; |
||||
import com.fanruan.api.design.ui.layout.TableLayoutKit; |
||||
import com.fr.base.Utils; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.plugin.third.party.jsdibjj.CustomGanttChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.Vector; |
||||
|
||||
public class CustomGanttTitlePane extends BaseOtherPane<CustomGanttChart> { |
||||
private UIFormulaTextField titleFormulaTextField; |
||||
private UIColorButton colorSelectPane; |
||||
private UICheckBox fontStyleCheckBox; |
||||
private UICheckBox fontWeightCheckBox; |
||||
private UIComboBox fontNameComboBox; |
||||
private UIComboBox fontSizeComboBox; |
||||
private UIComboBox leftComboBox; |
||||
|
||||
private UIComboBox fontNameSeriesNameComboBox; |
||||
private UIComboBox fontSizeSeriesNameComboBox; |
||||
private UIColorButton colorSelectSeriesNamePane; |
||||
|
||||
@Override |
||||
public void populate(CustomGanttChart ob) { |
||||
titleFormulaTextField.populateBean(ob.getTitleFormula().toString()); |
||||
|
||||
colorSelectPane.setColor(new Color(ob.getTitleTextStyleColor())); |
||||
colorSelectPane.repaint(); |
||||
if ("normal".equalsIgnoreCase(ob.getTitleTextStyleFontStyle())) { |
||||
fontStyleCheckBox.setSelected(false); |
||||
} else { |
||||
fontStyleCheckBox.setSelected(true); |
||||
} |
||||
if ("normal".equalsIgnoreCase(ob.getTitleTextStyleFontWeight())) { |
||||
fontWeightCheckBox.setSelected(false); |
||||
} else { |
||||
fontWeightCheckBox.setSelected(true); |
||||
} |
||||
fontNameComboBox.setSelectedItem(ob.getTitleTextStyleFontFamily()); |
||||
fontSizeComboBox.setSelectedItem(ob.getTitleTextStyleFontSize()); |
||||
|
||||
if ("left".equalsIgnoreCase(ob.getTitleLeft())) { |
||||
leftComboBox.setSelectedIndex(0); |
||||
} else if ("center".equalsIgnoreCase(ob.getTitleLeft())) { |
||||
leftComboBox.setSelectedIndex(1); |
||||
} else if ("right".equalsIgnoreCase(ob.getTitleLeft())) { |
||||
leftComboBox.setSelectedIndex(2); |
||||
} else { |
||||
leftComboBox.setSelectedIndex(1); |
||||
} |
||||
|
||||
|
||||
fontNameSeriesNameComboBox.setSelectedItem(ob.getSeriesNameTextStyleFontFamily()); |
||||
fontSizeSeriesNameComboBox.setSelectedItem(ob.getSeriesNameTextStyleFontSize()); |
||||
colorSelectSeriesNamePane.setColor(new Color(ob.getSeriesNameTextStyleColor())); |
||||
colorSelectSeriesNamePane.repaint(); |
||||
} |
||||
|
||||
@Override |
||||
public void update(CustomGanttChart ob) { |
||||
ob.getTitleFormula().setContent(titleFormulaTextField.updateBean()); |
||||
ob.setTitleTextStyleColor(colorSelectPane.getColor().getRGB()); |
||||
if (fontStyleCheckBox.isSelected()) { |
||||
ob.setTitleTextStyleFontStyle("italic"); |
||||
} else { |
||||
ob.setTitleTextStyleFontStyle("normal"); |
||||
} |
||||
|
||||
if (fontWeightCheckBox.isSelected()) { |
||||
ob.setTitleTextStyleFontWeight("bold"); |
||||
} else { |
||||
ob.setTitleTextStyleFontWeight("normal"); |
||||
} |
||||
ob.setTitleTextStyleFontFamily(String.valueOf(fontNameComboBox.getSelectedItem())); |
||||
ob.setTitleTextStyleFontSize((Integer) fontSizeComboBox.getSelectedItem()); |
||||
String leftValue = "center"; |
||||
String[] leftValues = {"left", "center", "right"}; |
||||
int index = leftComboBox.getSelectedIndex(); |
||||
if (index < 0) { |
||||
index = 1; |
||||
} |
||||
leftValue = leftValues[index]; |
||||
ob.setTitleLeft(leftValue); |
||||
|
||||
ob.setSeriesNameTextStyleFontFamily(String.valueOf(fontNameSeriesNameComboBox.getSelectedItem())); |
||||
ob.setSeriesNameTextStyleFontSize((Integer) fontSizeSeriesNameComboBox.getSelectedItem()); |
||||
ob.setSeriesNameTextStyleColor(colorSelectSeriesNamePane.getColor().getRGB()); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
JPanel panel = new JPanel(new BorderLayout(0, 6)); |
||||
titleFormulaTextField = new UIFormulaTextField(); |
||||
colorSelectPane = new UIColorButton(); |
||||
fontStyleCheckBox = new UICheckBox(); |
||||
fontWeightCheckBox = new UICheckBox(); |
||||
this.fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
||||
this.fontNameComboBox.setPreferredSize(new Dimension(144, 20)); |
||||
this.fontSizeComboBox = new UIComboBox(getFontSizes()); |
||||
this.fontSizeComboBox.setEditable(true); |
||||
leftComboBox = new UIComboBox(new String[]{"居左", "居中", "居右"}); |
||||
|
||||
Component[][] components = new Component[][]{ |
||||
{new UILabel(" 内容:"), titleFormulaTextField}, |
||||
{new UILabel(" 颜色:"), colorSelectPane}, |
||||
{new UILabel(" 斜体:"), fontStyleCheckBox}, |
||||
{new UILabel(" 加粗:"), fontWeightCheckBox}, |
||||
{new UILabel(" 字体:"), fontNameComboBox}, |
||||
{new UILabel(" 字体大小:"), fontSizeComboBox}, |
||||
{new UILabel(" 显示位置:"), leftComboBox} |
||||
}; |
||||
double p = TableLayoutKit.PREFERRED; |
||||
double[] rowSize = new double[]{p, p, p, p, p, p, p}; |
||||
double[] columnSize = new double[]{p, 120}; |
||||
JPanel settingsUI = TableLayoutKit.createTableLayoutPane(components, rowSize, columnSize); |
||||
settingsUI.setBorder(UITitledBorder.createBorderWithTitle("标题")); |
||||
|
||||
|
||||
this.fontNameSeriesNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
||||
this.fontNameSeriesNameComboBox.setPreferredSize(new Dimension(144, 20)); |
||||
this.fontSizeSeriesNameComboBox = new UIComboBox(getFontSizes()); |
||||
this.fontSizeSeriesNameComboBox.setEditable(true); |
||||
this.colorSelectSeriesNamePane = new UIColorButton(); |
||||
|
||||
Component[][] components1 = new Component[][]{ |
||||
//{new UILabel(" 字体:"), fontNameSeriesNameComboBox},
|
||||
{new UILabel(" 字体大小:"), fontSizeSeriesNameComboBox}, |
||||
//{new UILabel(" 颜色:"), colorSelectSeriesNamePane},
|
||||
}; |
||||
rowSize = new double[]{p, }; |
||||
JPanel settingsUI1 = TableLayoutKit.createTableLayoutPane(components1, rowSize, columnSize); |
||||
settingsUI1.setBorder(UITitledBorder.createBorderWithTitle("系列名称")); |
||||
panel.add(settingsUI, BorderLayout.NORTH); |
||||
panel.add(settingsUI1, BorderLayout.CENTER); |
||||
return panel; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return "字体"; |
||||
} |
||||
|
||||
|
||||
public static Vector<Integer> getFontSizes() { |
||||
Vector var0 = new Vector(); |
||||
|
||||
for (int var1 = 1; var1 < 100; ++var1) { |
||||
var0.add(var1); |
||||
} |
||||
|
||||
return var0; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.ui; |
||||
|
||||
import com.fanruan.api.design.chart.DefaultTypePane; |
||||
import com.fr.plugin.third.party.jsdibjj.CustomGanttChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
|
||||
public class CustomGanttTypePane extends DefaultTypePane<CustomGanttChart> { |
||||
//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/jsdibjj/images/chart_type.png" |
||||
}; |
||||
} |
||||
|
||||
@Override |
||||
protected int getSelectIndexInChart(CustomGanttChart chart) { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
protected void setSelectIndexInChart(CustomGanttChart 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(CustomGanttChart ob) { |
||||
super.populateBean(ob); |
||||
// buttonGroup.setSelectedIndex(StringKit.equals("left", ob.getLegendPosition()) ? 0 : 1);
|
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(CustomGanttChart ob) { |
||||
super.updateBean(ob); |
||||
// ob.setLegendPosition(buttonGroup.getSelectedIndex() == 0 ? "left" : "right");
|
||||
} |
||||
} |
@ -0,0 +1,72 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.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.gui.ispinner.UISpinner; |
||||
import com.fr.plugin.third.party.jsdibjj.CustomGanttChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class DisplayScaleConfPane extends BasicPane { |
||||
|
||||
private UISpinner scaleSpinner; |
||||
private UISpinner scaleXSpinner; |
||||
|
||||
public DisplayScaleConfPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
scaleSpinner = new UISpinner(0, 100, 1, 100); |
||||
scaleXSpinner = new UISpinner(0, 100, 1, 100); |
||||
//this.add(new UILabel("Y轴比例:"));
|
||||
//this.add(scaleSpinner);
|
||||
Component[][] components = new Component[][]{ |
||||
{new UILabel("竖轴比例:"), scaleSpinner}, |
||||
{new UILabel("横轴比例:"), scaleXSpinner} |
||||
}; |
||||
double p = TableLayoutKit.PREFERRED; |
||||
double[] rowSize = new double[]{p, p}; |
||||
double[] columnSize = new double[]{p, 100}; |
||||
JPanel settingsUI = TableLayoutKit.createTableLayoutPane(components, rowSize, columnSize); |
||||
this.add(settingsUI, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public void populate(CustomGanttChart ob) { |
||||
int yValue = ob.getDisplayScale(); |
||||
yValue = getValue(yValue); |
||||
int xValue = ob.getDisplayXScale(); |
||||
xValue = getValue(xValue); |
||||
scaleSpinner.setValue(yValue, true); |
||||
scaleXSpinner.setValue(xValue, true); |
||||
} |
||||
|
||||
private int getValue(int value) { |
||||
if (value <= 0) { |
||||
value = 0; |
||||
} |
||||
if (value >= 100) { |
||||
value = 100; |
||||
} |
||||
return value; |
||||
} |
||||
|
||||
|
||||
public void update(CustomGanttChart ob) { |
||||
int yValue = (int) scaleSpinner.getValue(); |
||||
yValue = getValue(yValue); |
||||
int xValue = (int) scaleXSpinner.getValue(); |
||||
xValue = getValue(xValue); |
||||
ob.setDisplayScale(yValue); |
||||
ob.setDisplayXScale(xValue); |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return "显示比例"; |
||||
} |
||||
} |
@ -0,0 +1,116 @@
|
||||
package com.fr.plugin.third.party.jsdibjj.ui; |
||||
|
||||
import com.fanruan.api.design.ui.component.UILabel; |
||||
import com.fanruan.api.design.ui.layout.TableLayoutKit; |
||||
import com.fr.base.Utils; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.plugin.third.party.jsdibjj.CustomGanttChart; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.Vector; |
||||
|
||||
|
||||
/** |
||||
* 动画 |
||||
*/ |
||||
public class YFontConfPane extends BasicPane { |
||||
private static String[] SYMBOL_TYPES = {"rect", "circle", "roundRect", "triangle", "diamond", "pin", "arrow"}; |
||||
private static String[] SYMBOL_TYPE_NAMES = {"矩形", "圆形", "圆角矩形", "三角形", "菱形", "弹头", "箭头"}; |
||||
private UIColorButton colorSelectPane; |
||||
private UICheckBox fontStyleCheckBox; |
||||
private UICheckBox fontWeightCheckBox; |
||||
private UIComboBox fontNameComboBox; |
||||
private UIComboBox fontSizeComboBox; |
||||
|
||||
|
||||
public YFontConfPane() { |
||||
this.initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
colorSelectPane = new UIColorButton(); |
||||
fontStyleCheckBox = new UICheckBox(); |
||||
fontWeightCheckBox = new UICheckBox(); |
||||
this.fontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
||||
this.fontNameComboBox.setPreferredSize(new Dimension(144, 20)); |
||||
this.fontSizeComboBox = new UIComboBox(getFontSizes()); |
||||
this.fontSizeComboBox.setEditable(true); |
||||
Component[][] components = new Component[][]{ |
||||
{new UILabel(" 颜色:"), colorSelectPane}, |
||||
{new UILabel(" 斜体:"), fontStyleCheckBox}, |
||||
{new UILabel(" 加粗:"), fontWeightCheckBox}, |
||||
{new UILabel(" 字体:"), fontNameComboBox}, |
||||
{new UILabel(" 字体大小:"), fontSizeComboBox} |
||||
}; |
||||
double p = TableLayoutKit.PREFERRED; |
||||
double[] rowSize = new double[]{p, p, p, p, p}; |
||||
double[] columnSize = new double[]{p, 120}; |
||||
JPanel settingsUI = TableLayoutKit.createTableLayoutPane(components, rowSize, columnSize); |
||||
this.add(settingsUI, BorderLayout.CENTER); |
||||
} |
||||
|
||||
protected String title4PopupWindow() { |
||||
return "color"; |
||||
} |
||||
|
||||
|
||||
public void populate(CustomGanttChart ob) { |
||||
colorSelectPane.setColor(new Color(ob.getyAxisAxisLabelColor())); |
||||
colorSelectPane.repaint(); |
||||
if ("normal".equalsIgnoreCase(ob.getyAxisAxisLabelFontStyle())) { |
||||
fontStyleCheckBox.setSelected(false); |
||||
} else { |
||||
fontStyleCheckBox.setSelected(true); |
||||
} |
||||
if ("normal".equalsIgnoreCase(ob.getyAxisAxisLabelFontWeight())) { |
||||
fontWeightCheckBox.setSelected(false); |
||||
} else { |
||||
fontWeightCheckBox.setSelected(true); |
||||
} |
||||
fontNameComboBox.setSelectedItem(ob.getyAxisAxisLabelFontFamily()); |
||||
fontSizeComboBox.setSelectedItem(ob.getyAxisAxisLabelFontSize()); |
||||
} |
||||
|
||||
public CustomGanttChart update() { |
||||
CustomGanttChart ob = new CustomGanttChart(); |
||||
ob.setyAxisAxisLabelColor(colorSelectPane.getColor().getRGB()); |
||||
if (fontStyleCheckBox.isSelected()) { |
||||
ob.setyAxisAxisLabelFontStyle("italic"); |
||||
} else { |
||||
ob.setyAxisAxisLabelFontStyle("normal"); |
||||
} |
||||
|
||||
if (fontWeightCheckBox.isSelected()) { |
||||
ob.setyAxisAxisLabelFontWeight("bold"); |
||||
} else { |
||||
ob.setyAxisAxisLabelFontWeight("normal"); |
||||
} |
||||
ob.setyAxisAxisLabelFontFamily((String) fontNameComboBox.getSelectedItem()); |
||||
ob.setyAxisAxisLabelFontSize((Integer) fontSizeComboBox.getSelectedItem()); |
||||
return ob; |
||||
} |
||||
|
||||
private int getSymbolTypeIndex(String type) { |
||||
for (int i = 0, max = SYMBOL_TYPES.length - 1; i <= max; i++) { |
||||
if (SYMBOL_TYPES[i].equalsIgnoreCase(type)) { |
||||
return i; |
||||
} |
||||
} |
||||
return 0; |
||||
} |
||||
|
||||
public static Vector<Integer> getFontSizes() { |
||||
Vector var0 = new Vector(); |
||||
|
||||
for (int var1 = 1; var1 < 100; ++var1) { |
||||
var0.add(var1); |
||||
} |
||||
|
||||
return var0; |
||||
} |
||||
} |
After Width: | Height: | Size: 292 B |
After Width: | Height: | Size: 555 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,42 @@
|
||||
.echarts-custom-gantt-progress-bar-div { |
||||
position: absolute; |
||||
background-color: #1a1a1a; |
||||
border-radius: 5px; |
||||
box-shadow: 0 1px 5px #d8cfcf inset, 0 1px 0 #444; |
||||
z-index: 9999; |
||||
} |
||||
|
||||
.echarts-custom-gantt-progress-bar-div span { |
||||
/*background-color: #34c2e3;*/ |
||||
background-image: -webkit-gradient(linear, 0 0, 100% 100%, color-stop(.25, rgba(255, 255, 255, .2)), color-stop(.25, transparent), color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.75, rgba(255, 255, 255, .2)), color-stop(.75, transparent), to(transparent)); |
||||
background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent); |
||||
-webkit-animation: animate-stripes 2s linear infinite; |
||||
-moz-animation: animate-stripes 2s linear infinite; |
||||
animation: animate-stripes 2s linear infinite; |
||||
background-size: 20px 20px; |
||||
height: 100%; |
||||
display: inline-block; |
||||
} |
||||
|
||||
|
||||
@-webkit-keyframes animate-stripes { |
||||
|
||||
0% { |
||||
background-position: 0 0; |
||||
} |
||||
|
||||
100% { |
||||
background-position: 60px 0; |
||||
} |
||||
|
||||
} |
||||
|
||||
@-moz-keyframes animate-stripes { |
||||
|
||||
0% { |
||||
background-position: 0 0; |
||||
} |
||||
100% { |
||||
background-position: 60px 0; |
||||
} |
||||
} |
@ -0,0 +1,876 @@
|
||||
!(function () { |
||||
Van.FRChartBridge.customGanttPlusWrapper = Van.FRChartBridge.AbstractChart.extend({ |
||||
|
||||
_init: function (dom, option) { |
||||
debugger; |
||||
if (!(option.dataStatus === true)) { |
||||
return; |
||||
} |
||||
|
||||
var textFontSize = option.seriesNameFont.seriesNameTextStyleFontSize; |
||||
|
||||
|
||||
var graphDatasConf = option.graphDatasConf; |
||||
var graphDatas = []; |
||||
|
||||
for (var i = 0, max = graphDatasConf.length - 1; i <= max; i++) { |
||||
var conf = graphDatasConf[i]; |
||||
var symbolValue = 'circle'; |
||||
var iconPath = ""; |
||||
if (conf.type == 'image') { |
||||
iconPath = FR.fineServletURL + '/resources?path=' + conf.path; |
||||
symbolValue = 'image://' + iconPath; |
||||
} |
||||
var graphData = {}; |
||||
graphData.value = [conf.x, conf.y]; |
||||
graphData.symbol = symbolValue; |
||||
//graphData.symbolSize = 20;
|
||||
graphData.itemStyle = {color: 'red'}; |
||||
graphDatas.push(graphData); |
||||
} |
||||
|
||||
var fineServletURLResourcesValue = FR.fineServletURL + '/resources?path='; |
||||
|
||||
/* |
||||
* 颜色取反色 |
||||
* */ |
||||
function reverseColor(OldColorValue) { |
||||
var OldColorValue = "0x" + OldColorValue.replace(/#/g, ""); |
||||
var str = "000000" + (0xFFFFFF - OldColorValue).toString(16); |
||||
return "#" + str.substring(str.length - 6, str.length); |
||||
} |
||||
|
||||
function isStringEmpty(value) { |
||||
if ((value == undefined) || (value == null) || (value.length <= 0)) { |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
function subStringByLength(str, index, length) { |
||||
if (isStringEmpty(str)) { |
||||
return ""; |
||||
} |
||||
return str.substr(index, length); |
||||
} |
||||
|
||||
function getRealValue(value) { |
||||
//针对echarts的bug处理,若系列名称有数字,有中文,会默认按数字处理,有中文会显示NaN,故在前面加"甘特图"处理
|
||||
if ((value == undefined) || (value == null)) { |
||||
return ""; |
||||
} |
||||
if (typeof (value) != 'string') { |
||||
return value; |
||||
} |
||||
if (value.length <= 3) { |
||||
return value; |
||||
} |
||||
if (value.substr(0, 3) != "甘特图") { |
||||
return value; |
||||
} |
||||
var tempValue = value.substring(3); |
||||
return tempValue; |
||||
} |
||||
|
||||
var tempRate = 0.1; |
||||
|
||||
var rectHeight = 0; |
||||
var linesEnable = option.ganttData.animationOption; |
||||
var projectCycleColorOption = option.projectCycleColor; |
||||
var flashingDataMap = new Map(); |
||||
|
||||
function renderItem(params, api) { |
||||
//debugger;
|
||||
var categoryIndex = api.value(0); |
||||
var start = api.coord([api.value(1), categoryIndex]); |
||||
var end = api.coord([api.value(2), categoryIndex]); |
||||
var width = end[0] - start[0]; |
||||
var height = api.size([0, 1])[1] * 0.6; |
||||
rectHeight = height; |
||||
|
||||
var rectShape = echarts.graphic.clipRectByRect({ |
||||
x: start[0], |
||||
y: start[1] - height / 2, |
||||
width: width, |
||||
height: height |
||||
}, { |
||||
x: params.coordSys.x, |
||||
y: params.coordSys.y, |
||||
width: params.coordSys.width, |
||||
height: params.coordSys.height |
||||
}); |
||||
|
||||
var schedule = api.value(5); |
||||
var rectShape1 = echarts.graphic.clipRectByRect({ |
||||
x: start[0] + width * schedule, |
||||
//x: start[0],
|
||||
y: start[1] - height / 2, |
||||
//width: width * schedule,
|
||||
width: width * (1 - schedule), |
||||
height: height |
||||
}, { |
||||
x: params.coordSys.x, |
||||
y: params.coordSys.y, |
||||
width: params.coordSys.width, |
||||
height: params.coordSys.height |
||||
}); |
||||
|
||||
var rectShape2 = echarts.graphic.clipRectByRect({ |
||||
//x: start[0] + width * schedule,
|
||||
x: start[0], |
||||
y: start[1] - height / 2, |
||||
width: width * schedule, |
||||
//width: width * (1 - schedule),
|
||||
height: height |
||||
}, { |
||||
x: params.coordSys.x, |
||||
y: params.coordSys.y, |
||||
width: params.coordSys.width, |
||||
height: params.coordSys.height |
||||
}); |
||||
|
||||
var textValue = api.value(3); |
||||
textValue = getRealValue(textValue); |
||||
|
||||
var completedColorHex = api.value(6); |
||||
//var incompleteColorHex = api.value(7);
|
||||
var incompleteColorHex = completedColorHex + "33"; |
||||
//completedColorHex="rgb(255,0,0)";
|
||||
//incompleteColorHex="rgb(255,0,0)";
|
||||
incompleteColorHex = completedColorHex; |
||||
|
||||
var showType = api.value(9); |
||||
|
||||
|
||||
if (showType == "IMAGE") { |
||||
debugger; |
||||
var rectShapeFill = echarts.graphic.clipRectByRect({ |
||||
x: start[0], |
||||
y: start[1] - height / 2, |
||||
width: width, |
||||
height: height |
||||
}, { |
||||
x: params.coordSys.x, |
||||
y: params.coordSys.y, |
||||
width: params.coordSys.width, |
||||
height: params.coordSys.height |
||||
}); |
||||
|
||||
var imagePath = fineServletURLResourcesValue + api.value(11); |
||||
|
||||
return { |
||||
type: 'image', |
||||
//x: start[0],
|
||||
//y: start[1] - height / 2,
|
||||
style: { |
||||
image: imagePath, |
||||
width: 40, |
||||
height: height |
||||
}, |
||||
position: [start[0], start[1] - height / 2] |
||||
}; |
||||
} |
||||
|
||||
if (projectCycleColorOption == true) { |
||||
|
||||
//debugger;
|
||||
var rectShapeFill = echarts.graphic.clipRectByRect({ |
||||
x: start[0], |
||||
y: start[1] - height / 2, |
||||
width: width, |
||||
height: height |
||||
}, { |
||||
x: params.coordSys.x, |
||||
y: params.coordSys.y, |
||||
width: params.coordSys.width, |
||||
height: params.coordSys.height |
||||
}); |
||||
|
||||
var textColor = reverseColor(completedColorHex); |
||||
/*return rectShape && { |
||||
type: 'rect', |
||||
ignore: !rectShapeFill, |
||||
shape: rectShapeFill, |
||||
style: api.style({ |
||||
fill: completedColorHex, |
||||
stroke: completedColorHex, |
||||
text: textValue, |
||||
//textFill: '#000000',
|
||||
fontSize: textFontSize, |
||||
textFill: textColor, |
||||
borderColor: textColor, |
||||
lineWidth: 1 |
||||
}) |
||||
};*/ |
||||
|
||||
return { |
||||
type: 'group', |
||||
children: [ |
||||
{ |
||||
type: 'rect', |
||||
ignore: !rectShapeFill, |
||||
shape: rectShapeFill, |
||||
style: api.style({ |
||||
fill: completedColorHex, |
||||
stroke: completedColorHex, |
||||
text: textValue, |
||||
//textFill: '#000000',
|
||||
fontSize: textFontSize, |
||||
textFill: textColor, |
||||
borderColor: textColor, |
||||
lineWidth: 1 |
||||
}) |
||||
}, |
||||
{ |
||||
type: 'rect', |
||||
ignore: !rectShape1, |
||||
shape: rectShape1, |
||||
//style: api.style({fill: '#ef2000'})
|
||||
style: api.style({ |
||||
fill: 'rgba(255, 255, 255, 0.5)', |
||||
stroke: 'rgba(255, 255, 255, 0.5)', |
||||
borderColor: 'transparent', |
||||
lineWidth: 0 |
||||
}) |
||||
}, |
||||
{ |
||||
type: 'rect', |
||||
ignore: !rectShapeFill, |
||||
shape: rectShapeFill, |
||||
style: api.style({ |
||||
fill: 'transparent', |
||||
stroke: 'transparent', |
||||
text: textValue, |
||||
fontSize: textFontSize, |
||||
textFill: textColor, |
||||
borderColor: 'transparent', |
||||
lineWidth: 0 |
||||
}) |
||||
} |
||||
|
||||
] |
||||
}; |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
if (showType == "BACKGROUND") { |
||||
var rectShapeFill = echarts.graphic.clipRectByRect({ |
||||
x: start[0], |
||||
y: start[1] - height / 2, |
||||
width: width, |
||||
height: height |
||||
}, { |
||||
x: params.coordSys.x, |
||||
y: params.coordSys.y, |
||||
width: params.coordSys.width, |
||||
height: params.coordSys.height |
||||
}); |
||||
|
||||
return rectShape && { |
||||
type: 'rect', |
||||
ignore: !rectShapeFill, |
||||
shape: rectShapeFill, |
||||
style: api.style({ |
||||
fill: completedColorHex, |
||||
stroke: completedColorHex, |
||||
lineWidth: 1 |
||||
}) |
||||
}; |
||||
} |
||||
|
||||
|
||||
if (showType == "FILL") { |
||||
//debugger;
|
||||
var flashingId = api.value(0) + "f" + api.value(10); |
||||
var size = [width, height]; |
||||
flashingDataMap.set(flashingId, size); |
||||
|
||||
var rectShapeFill = echarts.graphic.clipRectByRect({ |
||||
x: start[0], |
||||
y: start[1] - height / 2, |
||||
width: width, |
||||
height: height |
||||
}, { |
||||
x: params.coordSys.x, |
||||
y: params.coordSys.y, |
||||
width: params.coordSys.width, |
||||
height: params.coordSys.height |
||||
}); |
||||
|
||||
return rectShape && { |
||||
type: 'rect', |
||||
ignore: !rectShapeFill, |
||||
shape: rectShapeFill, |
||||
style: api.style({ |
||||
fill: completedColorHex, |
||||
stroke: completedColorHex, |
||||
lineWidth: 1 |
||||
}) |
||||
}; |
||||
} |
||||
|
||||
var linesEnable_1 = true; |
||||
if (linesEnable_1 == true) { |
||||
return { |
||||
type: 'group', |
||||
children: [ |
||||
{ |
||||
type: 'rect', |
||||
ignore: !rectShape1, |
||||
shape: rectShape1, |
||||
//style: api.style({fill: '#ef2000'})
|
||||
style: api.style({ |
||||
fill: incompleteColorHex, |
||||
//fill: "#eae1e1",
|
||||
stroke: incompleteColorHex, |
||||
lineWidth: 1 |
||||
}) |
||||
}, |
||||
{ |
||||
type: 'rect', |
||||
ignore: !rectShape2, |
||||
shape: rectShape2, |
||||
//style: api.style({fill: '#ef2000'})
|
||||
style: api.style({ |
||||
//fill: incompleteColorHex,
|
||||
fill: "transparent", |
||||
stroke: incompleteColorHex, |
||||
lineWidth: 1 |
||||
}) |
||||
}, |
||||
{ |
||||
type: 'rect', |
||||
ignore: !rectShape, |
||||
shape: rectShape, |
||||
style: api.style({ |
||||
fill: 'transparent', |
||||
stroke: 'transparent', |
||||
text: textValue, |
||||
fontSize: textFontSize, |
||||
textFill: '#000000' |
||||
}), |
||||
styleEmphasis: api.styleEmphasis() |
||||
}] |
||||
}; |
||||
} |
||||
|
||||
|
||||
return { |
||||
type: 'group', |
||||
children: [ |
||||
{ |
||||
type: 'rect', |
||||
ignore: !rectShape, |
||||
shape: rectShape, |
||||
//style: api.style({fill: '#ddb30b'})
|
||||
style: api.style({ |
||||
fill: completedColorHex, |
||||
stroke: incompleteColorHex, |
||||
lineWidth: 1 |
||||
}) |
||||
}, |
||||
{ |
||||
type: 'rect', |
||||
ignore: !rectShape2, |
||||
shape: rectShape2, |
||||
//style: api.style({fill: '#ef2000'})
|
||||
style: api.style({ |
||||
fill: incompleteColorHex, |
||||
//fill: "#eae1e1",
|
||||
stroke: incompleteColorHex, |
||||
lineWidth: 1 |
||||
}) |
||||
}, |
||||
{ |
||||
type: 'rect', |
||||
ignore: !rectShape, |
||||
shape: rectShape, |
||||
style: api.style({ |
||||
fill: 'transparent', |
||||
stroke: 'transparent', |
||||
text: textValue, |
||||
fontSize: textFontSize, |
||||
textFill: '#000000' |
||||
}), |
||||
styleEmphasis: api.styleEmphasis() |
||||
}] |
||||
}; |
||||
}; |
||||
|
||||
//var currentTimestamp = (new Date()).getTime();
|
||||
|
||||
var dateLineWidth = option.ganttData.dateLine.width; |
||||
if (dateLineWidth <= 0) { |
||||
dateLineWidth = 2; |
||||
} |
||||
|
||||
var dateLineWidthConf = {}; |
||||
if (option.ganttData.dateLine.enable) { |
||||
dateLineWidthConf = { |
||||
tooltip: {show: false}, |
||||
symbol: "none", |
||||
data: [ |
||||
{ |
||||
silent: true, |
||||
lineStyle: { |
||||
type: "solid", |
||||
color: option.ganttData.dateLine.color, |
||||
width: dateLineWidth |
||||
}, |
||||
label: { |
||||
position: 'start', |
||||
formatter: "当前时间\n" + option.ganttData.dateLine.currentDateShow |
||||
}, |
||||
xAxis: option.ganttData.dateLine.currentDate |
||||
} |
||||
] |
||||
}; |
||||
} |
||||
|
||||
function getDateValueFormatter(value, index) { |
||||
var tempDate = new Date(value); |
||||
var tempYear = tempDate.getFullYear(); |
||||
var tempMonth = tempDate.getMonth() + 1; |
||||
if (tempMonth <= 9) { |
||||
tempMonth = '0'.concat(tempMonth); |
||||
} |
||||
var tempDay = tempDate.getDate(); |
||||
if (tempDay <= 9) { |
||||
tempDay = '0'.concat(tempDay); |
||||
} |
||||
var content = tempYear + "-" + tempMonth + "-" + tempDay; |
||||
return content; |
||||
} |
||||
|
||||
|
||||
var ganttOption = { |
||||
tooltip: { |
||||
formatter: function (params) { |
||||
if (isStringEmpty(params.showType) && isStringEmpty(params.data.showType)) { |
||||
return ""; |
||||
} |
||||
|
||||
if (params.data.showType == "BACKGROUND") { |
||||
return ""; |
||||
} |
||||
|
||||
if (params.data.showType == "FILL") { |
||||
return "接替脱节" + params.data.days + "天"; |
||||
} |
||||
var seriesName = params.name; |
||||
seriesName = getRealValue(seriesName); |
||||
var schedule = params.value[8]; |
||||
return seriesName + ': 进度' + schedule + "<br/>" + subStringByLength(params.data.beginDateShow, 0, 10) + "至" + subStringByLength(params.data.endDateShow, 0, 10); |
||||
} |
||||
}, |
||||
title: { |
||||
//text: option.ganttTitle,
|
||||
//left: 'center'
|
||||
text: option.ganttTitle.titleText, |
||||
left: option.ganttTitle.titleLeft, |
||||
//textAlign: 'center'
|
||||
textStyle: { |
||||
color: option.ganttTitle.titleTextStyleColor, |
||||
fontStyle: option.ganttTitle.titleTextStyleFontStyle, |
||||
fontWeight: option.ganttTitle.titleTextStyleFontWeight, |
||||
fontFamily: option.ganttTitle.titleTextStyleFontFamily, |
||||
fontSize: option.ganttTitle.titleTextStyleFontSize |
||||
} |
||||
}, |
||||
dataZoom: [ |
||||
{ |
||||
type: 'slider', |
||||
filterMode: 'weakFilter', |
||||
showDataShadow: false, |
||||
bottom: 0, |
||||
height: 10, |
||||
borderColor: 'transparent', |
||||
backgroundColor: '#e2e2e2', |
||||
// backgroundColor: '#ff0000',
|
||||
handleIcon: 'M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z', // jshint ignore:line
|
||||
handleSize: 20, |
||||
handleStyle: { |
||||
shadowBlur: 6, |
||||
shadowOffsetX: 1, |
||||
shadowOffsetY: 2, |
||||
shadowColor: '#aaa' |
||||
}, |
||||
labelFormatter: '' |
||||
}, { |
||||
type: 'inside', |
||||
filterMode: 'weakFilter' |
||||
}, { |
||||
type: 'slider', |
||||
yAxisIndex: 0, |
||||
zoomLock: true, |
||||
width: 10, |
||||
right: 10, |
||||
top: 0, |
||||
bottom: 20, |
||||
//start: 20,
|
||||
start: option.ganttData.displayScale, |
||||
end: 100, |
||||
handleSize: 0, |
||||
showDetail: false, |
||||
}, { |
||||
type: 'inside', |
||||
id: 'insideY', |
||||
yAxisIndex: 0, |
||||
// start: 20,
|
||||
start: option.ganttData.displayScale, |
||||
end: 100, |
||||
zoomOnMouseWheel: false, |
||||
moveOnMouseMove: true, |
||||
moveOnMouseWheel: true |
||||
}], |
||||
grid: { |
||||
//height: 300
|
||||
top: 5, |
||||
containLabel: true |
||||
}, |
||||
xAxis: { |
||||
min: option.ganttData.minDate, |
||||
max: option.ganttData.maxDate, |
||||
scale: true, |
||||
type: 'time', |
||||
position: 'top', |
||||
splitLine: { |
||||
lineStyle: { |
||||
color: ['#E9EDFF'] |
||||
} |
||||
}, |
||||
axisLine: { |
||||
show: false |
||||
}, |
||||
axisTick: { |
||||
lineStyle: { |
||||
color: '#929ABA' |
||||
} |
||||
}, |
||||
axisLabel: { |
||||
color: '#929ABA', |
||||
inside: false, |
||||
align: 'center', |
||||
formatter: getDateValueFormatter |
||||
} |
||||
}, |
||||
yAxis: { |
||||
data: option.ganttData.categories, |
||||
axisLabel: { |
||||
color: option.yAxisAxisLabelFont.yAxisAxisLabelColor, |
||||
fontStyle: option.yAxisAxisLabelFont.yAxisAxisLabelFontStyle, |
||||
fontWeight: option.yAxisAxisLabelFont.yAxisAxisLabelFontWeight, |
||||
fontFamily: option.yAxisAxisLabelFont.yAxisAxisLabelFontFamily, |
||||
fontSize: option.yAxisAxisLabelFont.yAxisAxisLabelFontSize |
||||
} |
||||
}, |
||||
series: [ |
||||
{ |
||||
type: 'custom', |
||||
zlevel: 5, |
||||
markLine: dateLineWidthConf |
||||
}, |
||||
/*{ |
||||
type: 'lines', |
||||
polyline: true, |
||||
coordinateSystem: 'cartesian2d', |
||||
lineStyle: { |
||||
type: 'dashed', |
||||
width: 0, |
||||
//color: '#175064',
|
||||
curveness: 0.3 |
||||
|
||||
}, |
||||
effect: { |
||||
show: true, |
||||
trailLength: 0.1, |
||||
symbol: 'rect', |
||||
//color: 'orange',
|
||||
symbolSize: 2, |
||||
period: 2 |
||||
}, |
||||
data: option.ganttData.linesData, |
||||
zlevel: 10 |
||||
},*/ |
||||
{ |
||||
type: 'custom', |
||||
renderItem: renderItem, |
||||
itemStyle: { |
||||
opacity: 0.8 |
||||
}, |
||||
encode: { |
||||
x: [1, 2], |
||||
y: 0 |
||||
}, |
||||
data: option.ganttData.seriesData, |
||||
zlevel: 20 |
||||
// markLine: dateLineWidthConf
|
||||
} |
||||
] |
||||
}; |
||||
|
||||
var chart = echarts.init(dom); |
||||
|
||||
//绑定点击触发超链函数
|
||||
chart.on('click', this.getLinkFun()); |
||||
chart.setOption(ganttOption, true); |
||||
//var tempOption = chart.getOption();
|
||||
//var symbolSizeValue = chart._api.size([0, 1])[1] * 0.6;
|
||||
//var symbolSizeValue = chart._api.getHeight();
|
||||
|
||||
// rectHeight = rectHeight*0.5;
|
||||
var periodValue = 2; |
||||
if (linesEnable == true) { |
||||
periodValue = 2; |
||||
} else { |
||||
periodValue = 0; |
||||
} |
||||
var ganttOption1 = { |
||||
tooltip: { |
||||
formatter: function (params) { |
||||
if (isStringEmpty(params.showType) && isStringEmpty(params.data.showType)) { |
||||
return ""; |
||||
} |
||||
var seriesName = params.name; |
||||
seriesName = getRealValue(seriesName); |
||||
var schedule = params.value[8]; |
||||
|
||||
if (params.data.showType == "BACKGROUND") { |
||||
return ""; |
||||
} |
||||
if (params.data.showType == "FILL") { |
||||
return ""; |
||||
} |
||||
if (params.data.showType == "IMAGE") { |
||||
return schedule + "<br/>时间:" + subStringByLength(params.data.beginDateShow, 0, 10) |
||||
} |
||||
|
||||
return seriesName + "<br/>" + '进度' + schedule + "<br/>" + subStringByLength(params.data.beginDateShow, 0, 10) + "至" + subStringByLength(params.data.endDateShow, 0, 10); |
||||
} |
||||
}, |
||||
title: { |
||||
text: option.ganttTitle.titleText, |
||||
left: option.ganttTitle.titleLeft, |
||||
//textAlign: 'center'
|
||||
textStyle: { |
||||
color: option.ganttTitle.titleTextStyleColor, |
||||
fontStyle: option.ganttTitle.titleTextStyleFontStyle, |
||||
fontWeight: option.ganttTitle.titleTextStyleFontWeight, |
||||
fontFamily: option.ganttTitle.titleTextStyleFontFamily, |
||||
fontSize: option.ganttTitle.titleTextStyleFontSize |
||||
} |
||||
}, |
||||
dataZoom: [ |
||||
{ |
||||
type: 'slider', |
||||
filterMode: 'weakFilter', |
||||
showDataShadow: false, |
||||
bottom: 0, |
||||
height: 10, |
||||
borderColor: 'transparent', |
||||
backgroundColor: '#e2e2e2', |
||||
// backgroundColor: '#ff0000',
|
||||
handleIcon: 'M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z', // jshint ignore:line
|
||||
handleSize: 20, |
||||
handleStyle: { |
||||
shadowBlur: 6, |
||||
shadowOffsetX: 1, |
||||
shadowOffsetY: 2, |
||||
shadowColor: '#aaa' |
||||
}, |
||||
labelFormatter: '', |
||||
//start: 0,
|
||||
//end: option.ganttData.displayXScale
|
||||
start: option.ganttData.displayXScale, |
||||
end: 100 |
||||
}, { |
||||
type: 'inside', |
||||
filterMode: 'weakFilter' |
||||
}, { |
||||
type: 'slider', |
||||
yAxisIndex: 0, |
||||
zoomLock: true, |
||||
width: 10, |
||||
right: 10, |
||||
top: 70, |
||||
bottom: 20, |
||||
//start: 20,
|
||||
start: option.ganttData.displayScale, |
||||
end: 100, |
||||
handleSize: 0, |
||||
showDetail: false, |
||||
}, { |
||||
type: 'inside', |
||||
id: 'insideY', |
||||
yAxisIndex: 0, |
||||
// start: 20,
|
||||
start: option.ganttData.displayScale, |
||||
end: 100, |
||||
zoomOnMouseWheel: false, |
||||
moveOnMouseMove: true, |
||||
moveOnMouseWheel: true |
||||
}], |
||||
grid: { |
||||
//height: 300
|
||||
top: 5, |
||||
left: 5, |
||||
right: 30, |
||||
//bottom:5,
|
||||
containLabel: true |
||||
}, |
||||
xAxis: { |
||||
min: option.ganttData.minDate, |
||||
max: option.ganttData.maxDate, |
||||
scale: true, |
||||
type: 'time', |
||||
position: 'top', |
||||
splitLine: { |
||||
lineStyle: { |
||||
color: ['#E9EDFF'] |
||||
} |
||||
}, |
||||
axisLine: { |
||||
show: false |
||||
}, |
||||
axisTick: { |
||||
lineStyle: { |
||||
color: '#929ABA' |
||||
} |
||||
}, |
||||
axisLabel: { |
||||
color: '#929ABA', |
||||
inside: false, |
||||
align: 'center', |
||||
formatter: getDateValueFormatter |
||||
} |
||||
}, |
||||
yAxis: { |
||||
data: option.ganttData.categories, |
||||
axisLabel: { |
||||
//backgroundColor:'red',
|
||||
//height:2,
|
||||
color: option.yAxisAxisLabelFont.yAxisAxisLabelColor, |
||||
fontStyle: option.yAxisAxisLabelFont.yAxisAxisLabelFontStyle, |
||||
fontWeight: option.yAxisAxisLabelFont.yAxisAxisLabelFontWeight, |
||||
fontFamily: option.yAxisAxisLabelFont.yAxisAxisLabelFontFamily, |
||||
fontSize: option.yAxisAxisLabelFont.yAxisAxisLabelFontSize, |
||||
formatter: function (value, index) { |
||||
//debugger;
|
||||
var index = value.lastIndexOf("\n"); |
||||
if (index <= 0) { |
||||
return value; |
||||
} |
||||
var name = value.substring(0, index); |
||||
var name1 = value.substring(index + 1); |
||||
name1 = name1 || ''; |
||||
if (name1.length <= 0) { |
||||
return name; |
||||
} |
||||
if (option.fillGap.enable && (option.fillGap.enable == true)) { |
||||
return name + "\n" + "{suspendStyle|" + name1 + "}"; |
||||
} |
||||
return name; |
||||
}, |
||||
rich: { |
||||
suspendStyle: { |
||||
color: option.fillGap.color |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
series: [ |
||||
{ |
||||
type: 'custom', |
||||
zlevel: 0, |
||||
markLine: dateLineWidthConf |
||||
}, |
||||
{ |
||||
type: 'lines', |
||||
polyline: true, |
||||
coordinateSystem: 'cartesian2d', |
||||
lineStyle: { |
||||
type: 'dashed', |
||||
//width: rectHeight,
|
||||
width: 0, |
||||
//color: '#175064',
|
||||
opacity: 0.3, |
||||
curveness: 0.3 |
||||
|
||||
}, |
||||
effect: { |
||||
show: true, |
||||
trailLength: 0.1, |
||||
//symbol: 'diamond',
|
||||
//color: 'orange',
|
||||
//symbolSize: [rectHeight,10],
|
||||
symbol: option.ganttData.symbolType, |
||||
symbolSize: [rectHeight, option.ganttData.symbolWidth], |
||||
period: periodValue |
||||
//period: 0
|
||||
//constantSpeed: 20
|
||||
}, |
||||
data: option.ganttData.linesData, |
||||
zlevel: 10 |
||||
}, |
||||
{ |
||||
type: 'custom', |
||||
renderItem: renderItem, |
||||
itemStyle: { |
||||
opacity: 0.8 |
||||
}, |
||||
encode: { |
||||
x: [1, 2], |
||||
y: 0 |
||||
}, |
||||
data: option.ganttData.seriesData, |
||||
zlevel: 20 |
||||
// markLine: dateLineWidthConf
|
||||
}, { |
||||
type: 'graph', |
||||
layout: 'none', |
||||
coordinateSystem: 'cartesian2d', |
||||
symbolSize: 50, |
||||
label: { |
||||
show: false |
||||
}, |
||||
lineStyle: { |
||||
width: 0, |
||||
opacity: 1 |
||||
}, |
||||
data: graphDatas, |
||||
zlevel: 30 |
||||
|
||||
} |
||||
] |
||||
}; |
||||
if (linesEnable) { |
||||
// chart.setOption(ganttOption1, true);
|
||||
} |
||||
|
||||
chart.setOption(ganttOption1, true); |
||||
|
||||
chart.on('mouseover', function (params) { |
||||
//console.log(params);
|
||||
}); |
||||
chart.on('click', function (params) { |
||||
console.log(params); |
||||
}); |
||||
|
||||
return chart; |
||||
}, |
||||
|
||||
_refresh: function (chart, option) { |
||||
chart.setOption(option); |
||||
}, |
||||
|
||||
_resize: function (chart) { |
||||
chart.resize(); |
||||
}, |
||||
|
||||
_emptyData: function (options) { |
||||
return options.series.data.length === 0; |
||||
} |
||||
}) |
||||
})(); |
@ -0,0 +1,7 @@
|
||||
var document = { |
||||
createElement: function(element) { |
||||
if (element == 'canvas') { |
||||
return new Canvas(); |
||||
} |
||||
}, |
||||
}; |
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in new issue